Copy link to clipboard
Copied
Hello,
I want to create an action called 'test1' and record it playing a script called 'generic.jsx'.
I want the script to know that it was started by 'test1' and thus, do XYZ.
I want to create another action called 'test2' and have it play the same script called 'generic.jsx'.
From within that same script, being a generic one, I want to to now know that it was started by action 'test2' and do ABC.
How can I have my javascript know the name of the action that launched it?
Thanks in advance!
---
Shai
There is some code for getting the current action here...
Copy link to clipboard
Copied
Moving to Photoshop Scripting​
Copy link to clipboard
Copied
Why not just have the one script ask the user what it should do? Why do actions need to determine the script behaviour?
Copy link to clipboard
Copied
Hello and thanks for replying.
The action I've got runs the javascript. The action is called from either Lightroom or Bridge and is suppose to handle multiple (batch) jobs so there shouldn't be any interactivity with the user.
Copy link to clipboard
Copied
anyone?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hello SuperMerlin,
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?
I still think that I need to either have the javascript "know' what action started it (or is currently running) or be able to pass arguments from the recorded action to the javascript.
Copy link to clipboard
Copied
There is some code for getting the current action here...
Copy link to clipboard
Copied
Brilliant mate, thank you!
Copy link to clipboard
Copied
The "flag file" idea was an interesting one. It would look like this:
Rather than creating a separate file, however,
Another idea:
In the ExtendScript Tool, you can do this: `$.writeln(app.activeDocument.info.instructions)`