I have a series of actions that are all similar — they process a draft similarly, but assign different tags based on which action I run. Then the processed draft is saved to a note store in Dropbox.
I’d like to centralize this, and have created an action that prompts the user to select one of these actions using the Prompt action… but how do I use the results of the Prompt selection to run the specified action? Can it be done without scripting?
Separately, all of the actions use a script step, which are all the same. It seems like I should be able to put the script step into its own action, and just call it from each of the others — but when I try that, it fails. Are there any examples of this I can look at?
Install these 3 actions and run “Run X or Y” on a new empty draft.
It will call one of the other actions that each insert different text into the draft.
These actions use no scripting.
If you just use an include step to include your centralised script action it should just work. The ordering can matter if it is being called later in the action it needs to be included at an earlier point.
What is the error you get (in the draft log; look under the I in a circle icon for the details), what is the script you are running, and where in the action sequence is it/being used.
This is great, thanks! I think I was trying to get too fancy — I was using button (prompt) text that was different than the action names, and the. Trying to use a script to run a given action based on the prompt value. Much simpler to just make the button text the precise name of the action!
Oh, and when I try to use a central script action, and include it as an action step, I have trouble getting the variables out. Will experiment a bit more and then post something more specific if I still have problems. Thanks!
You certainly can use different ‘labels’ for different buttons that then trigger actions of a different name. But, this is an area where scripting comes in. It just allows you to do more sophisticted things.
Variables, it could be that you have things out of order and try to use them before they exist or they are out of scope - e.g. defined in a function, loop, etc. and not available outside of that. But the draft log is your best friend when debugging out what is going on with your variables. Well that and judicious use of console.log() or alert()