From 766102cc0c4b3ba6bb9b3bf609cab7e154542750 Mon Sep 17 00:00:00 2001 From: djmisterjon <24865815+djmisterjon@users.noreply.github.com> Date: Mon, 24 Feb 2020 13:31:02 -0500 Subject: [PATCH 1/2] add bash code for auto-open auto-create spine --- photoshop/PhotoshopToSpine.jsx | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/photoshop/PhotoshopToSpine.jsx b/photoshop/PhotoshopToSpine.jsx index ecd3819..ed116fd 100644 --- a/photoshop/PhotoshopToSpine.jsx +++ b/photoshop/PhotoshopToSpine.jsx @@ -354,6 +354,57 @@ function run () { jsonFile.write(json); jsonFile.close(); } + + //TODO: buttons check box + //TODO: Mac, linux environement test + 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 + } } // Settings dialog: From cf834aafea8e51399664a473e2a193c611c5e7ea Mon Sep 17 00:00:00 2001 From: djmisterjon <24865815+djmisterjon@users.noreply.github.com> Date: Mon, 24 Feb 2020 15:22:50 -0500 Subject: [PATCH 2/2] minor fix comment and format --- photoshop/PhotoshopToSpine.jsx | 45 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/photoshop/PhotoshopToSpine.jsx b/photoshop/PhotoshopToSpine.jsx index ed116fd..2ee6707 100644 --- a/photoshop/PhotoshopToSpine.jsx +++ b/photoshop/PhotoshopToSpine.jsx @@ -360,39 +360,40 @@ function run () { if('open spine Checked'){ function makeBash(){ var str = ''; - for (var i = 0, l = arguments.length; i < l; i++) { - var key = arguments[i]; - str+=key; + for (var i=0, l=arguments.length; i