Reply To: Is there a way to separate things like this Automatically?

#55459

Sure there is. You can use one script to run other scripts from, with the command 'doScript'.

You will have to experiment a bit, because sometimes scripts need specific starting circumstances — mine needs the cursor to be in the first line of text to check, and when it's done the cursor is on the last line it checked. Other scripts may need the cursor to be somewhere else, or nowhere, or have a frame selected (and so on) …

If you find yourself clicking several scripts in a row without doing anything else (that included repositioning the cursor!), you can safely chain them to run in sequence using just one script.

The framework script should contain this line for each script to run:

app.docScript (app.activeScript.path+'/yourScriptName.jsx');

The path stuff is because 'doScript' needs the exact run time path of the script that it's going to run — typically, that'd be the Scripts folder in your personal User data folder. Fortunately, you don't even have to type it in, because the “active” script — the one that is running — can ask “whence it was run from” (the activeScript.path property), and if all your scripts are in the same folder, you only have to tack on the name of the script to run.

This article was last modified on April 8, 2010

Comments (0)

Loading comments...