Copy link to clipboard
Copied
Hi,
I'm using 4 scripts to manage all my website dev, to exports images, slice, etc.. It's an amazing way to work with scripting, god I love it !
I wonder if I can link all my script together so I don't have to wait for each one to end then start the next one manually.
Is there a way to script this so once my first script is done, it start the next one... and so on... an on... ?
Thanks guy if you have an idea !
I think you can create one script where you do as follows:
eval("//@include 'Script1.jsx'")
eval("//@include 'Script2.jsx'")
eval("//@include 'Script3.jsx'")
eval("//@include 'Script4.jsx'")
The condition is that 'Includer.jsx' script must be in the same folder what all included scripts.
I think 'Includer' script doesn't have to check was previous script already finished that next one can be started.
Simply when one won't finish its job, another will be in pending, however I'm not sure, you must check
...Copy link to clipboard
Copied
I think you can create one script where you do as follows:
eval("//@include 'Script1.jsx'")
eval("//@include 'Script2.jsx'")
eval("//@include 'Script3.jsx'")
eval("//@include 'Script4.jsx'")
The condition is that 'Includer.jsx' script must be in the same folder what all included scripts.
I think 'Includer' script doesn't have to check was previous script already finished that next one can be started.
Simply when one won't finish its job, another will be in pending, however I'm not sure, you must check it on your own.
EDIT: I tested it creating 4 scripts (with names like those included ones in the example). Then to each of them I put:
alert(File($.fileName).name.match(/.*(?=\.)/))
As the result there popped up dialogs with consecutive names of included scripts. I mean by turns, not at once
Copy link to clipboard
Copied
thanks
I' ve create one with script listener, which is always more coding than need, still your solution and this one work.
// start next script ----------------------------
var idAdobeScriptAutomationScripts = stringIDToTypeID( "AdobeScriptAutomation Scripts" );
var desc6 = new ActionDescriptor();
var idjsNm = charIDToTypeID( "jsNm" );
desc6.putString( idjsNm, """File name here without extension""" );
var idjsMs = charIDToTypeID( "jsMs" );
desc6.putString( idjsMs, """[object Object]""" );
executeAction( idAdobeScriptAutomationScripts, desc6, DialogModes.NO );
////////////-------------------------------------------------------
Copy link to clipboard
Copied
You may also make a loop using either Include or ScriptListener method:
for(len = (pth = File(File($.fileName).parent)
.getFiles(/t\d+.jsx$/)).length; i < len; i++) {
eval("//@include '" + pth.name + "'")
}
for(len = (pth = File(File($.fileName).parent).getFiles(/t\d+.jsx$/)).length; i < len;) {
function sTT(v) {return stringIDToTypeID(v)} (dsc1 = new ActionDescriptor())
.putString(sTT('javaScriptName'), pth[i++].name.slice(0, -4))
executeAction(sTT('AdobeScriptAutomation Scripts'), dsc1, DialogModes.NO);
}
So this way you can base on chosen files from the folder (if you keep there aslo other ones). The above will work only for names: 'Script1.jsx', 'Script2.jsx', 'Script3.jsx', 'Script4.jsx', ..., otherwise regex code must be changed to match names you used.
Copy link to clipboard
Copied
i is undefined )
p.s.
I would use $.evalFile ( )
Copy link to clipboard
Copied
Yes it is, but it works I'm not sure but it might make only problem when some i will be used in one of those 4 scripts.
Longer time I scripted in CS2 where $.evalFile() wasn't present. I'm just used to still using simple eval
Whatever i is (un)defined I got strange result. Scripts were always opened in this order:
Script1, Script2, Script4, Script3. I recreated them but still that happens, why?
Copy link to clipboard
Copied
I used it at the end of each script, so rather than stop it start the next one.
Copy link to clipboard
Copied
Hi,
I am new to indesign script. I need to run my 3 scripts which is placed under the "Temo folder" (its folder name).
Can you share me the full script to run my multiple scripts?
by
hasvi
Copy link to clipboard
Copied
It's Photoshop Scripting forum. Anyway, all was already said, what you exactly want, describe it...
Copy link to clipboard
Copied
Hi,
I want to run 3 different scripts one by one. Need script for indesign, could you help me?
by
hasvi
Copy link to clipboard
Copied
Not to inDesign. Didn't anything in this theard work though?
Copy link to clipboard
Copied
Ok, I will post this query to Indesign forum.
thanks,
hasvi