Why not just have the one script ask the user what it should do? Why do actions need to determine the script behaviour?
Hello and thanks for replying.
You would need to get your actions to create a Flag file, this is any name you want. Then your generic jsx would look for the flag files and then know what action is was. make sure the generic jsx removes the flag file.
Thanks for the response.
What you're saying is, create a .jsx, copied multiple times, per action. Having another small .jsx per action, that would create a flag file 'abc' or 'xyz', which is hard-coded into it, would be the same as having the script that I'm writing, copied multiple times per action and just calling it differently and hard-code the 'abc' or 'xyz' code I need it to do. Am I wrong?
Brilliant mate, thank you!
The "flag file" idea was an interesting one. It would look like this:
- Action1 invokes Stub1.jsx which places "FromAction1" in "marker.file" and then invokes MAIN.jsx.
- MAIN.jsx inspects maker.file and acts accordingly.
Rather than creating a separate file, however,
- Action1.jsx can: add a transparent layer to the current active document called "FromAction1" and invoke MAIN.jsx.
- MAIN.jsx looks at the current active layer and uses its name to do the function for Action1.
- Action1 can directly update something in the current document.info (Record the File -> File Info) operation. E.g. update the Instructions data in the Origin field. (A recorded action step looks like this:
- Invoke MAIN.jsx which retrieves the information from the active document: `app.activeDocument.info.instructions`
In the ExtendScript Tool, you can do this: `$.writeln(app.activeDocument.info.instructions)`