How to stop running script??
Copy link to clipboard
Copied
Hi all
I've to stop running script through another script. is there a way to do it?
many thanks, H
Copy link to clipboard
Copied
I'm curious what is the purpose of one script stopping another? Can you explain a bit?
JS, VBS, AS?
In General: you can stop a running script between statements. You can't stop a script while it's waiting for InDesign after giving a e.g. print-command, until the printing is done.
The Running script is probably a loop?
In each loop cycle it has to check (maybe several time) if the condition to Stop is there. If it is, it has to reset the condition and satop.
Apparently there are no Global Variables that scripts can share. You can use e.g. app.label.
I know of a solution that uses smal a disk file, named "stopnameofrunningscript". If the file is created, the script deletes it and quits.
Make sure that the script gives other scripts and apps enough time to do their thing, otherwise it takes ages before the other script can change the condition (e.g. interact with the user if that is desired).
Copy link to clipboard
Copied
Well, Actually I do an automation. It will automatically take files from a folder and flows one by one into indesign then places figures and tables. finally the indd files will be moved to production. In certain situation we'll have to stop the process.
Copy link to clipboard
Copied
"Certain conditions": write a function that checks these conditions and make it the last statement of your loop?
Or do you want the user to pause/resume ?
Copy link to clipboard
Copied
what language - VB, JS, AS ?
robin
www.adobescripts.com
Copy link to clipboard
Copied
JavaScript
many thanks, H
Copy link to clipboard
Copied
The simplest way to go about this is to check a script label every once in a while.
Something like this:
if (app.extractLabel("hakkimsPrivateLabel")=="exit"){
AbortMyScript()
}
And then whenever you want to set the script to abort you simply set
app.insertLabel("hakkimsPrivateLabel","exit");
Harbs

