Nate लिखाI think your test should be:
app.system('"C:\\path with spaces\\test.bat" "1param with space" "2param with space"');
I usually try first with older versions, but I can try again on newer.
Ok i succeed to open a existing project with photoshop.
Am busy now so i will write a code for create new file projets and auto-open maybe tonight. 😃
But it work fine on my side, i just need to do more testing to find the best solution.
Nate लिखा
Ok here my friend, i pull a request here
https://github.com/EsotericSoftware/spine-scripts/pull/7
you just have to integrate a checkBox and test on the environment macos and linux.
Work 100% on my side (WINDOW).
So if project exist, it open projet only.
If not , it build a project and open.
if('open spine Checked'){
function makeBash(){
var str = '';
for (var i = 0, l = arguments.length; i < l; i++) {
var key = arguments[i];
str+=key;
}
return str;
}
var Q = '"' ; //Quote
var SQ = '" '; // SpaceQuote for arguments space
var spineExe = new File("C:\\Program Files (x86)\\Spine\\Spine.exe");
var spineCom = new File("C:\\Program Files (x86)\\Spine\\Spine.com");
var projectFile = new File(jsonFile.parent + "/" + name + ".spine");
var bashExe = makeBash(
'\n',
'start ',
Q+spineExe.fsName+SQ,
Q+projectFile.fsName+SQ,
'\n',
);
var bashCom = makeBash(
'\n',
'start ',
'/W /D ',
Q+spineCom.fsName.split('Spine.com')[0]+SQ,
'Spine.com ',
'-i ',
Q+jsonFile.fsName+SQ,
'-o ',
Q+projectFile.fsName+SQ,
'-r ',
'\n',
);
var tempBat = new File(jsonFile.parent+"/temp.bat");
tempBat.open("w");
tempBat.write('@echo off');
if(!projectFile.exists){
tempBat.write(bashCom);
}
tempBat.write(bashExe);
tempBat.write('cmd /k');
tempBat.close();
tempBat.execute()
//tempBat.remove(); // comment this to debug the bash script
}
}
The temp output for the batch script look like this
@echo off
start /W /D "C:\Program Files (x86)\Spine\" Spine.com -i "C:\Users\InformatiqueLepage\Desktop\Sans titre-1.json" -o "C:\Users\InformatiqueLepage\Desktop\Calque 0.spine" -r
start "C:\Program Files (x86)\Spine\Spine.exe" "C:\Users\InformatiqueLepage\Desktop\Calque 0.spine"
cmd /k
I can't code the photoshop button because am coding blindly without the photoshop sdk, and i don't know where to find it, i sot succeed to find it on adobe forum.