How to pass two variables from previous actions to "run applescript" in Automator
Solution 1:
For my normal usage, typically when using a Set Value of Variable action, the subsequent action will have the [√] Ignore this action's input checkbox checked. This is because one does not typically set a variable and then pass it directly to the next action, unless of course the value of that variable will also be needed elsewhere in the workflow and the next action also makes use of the variable. Since a Ask for Finder Items action in your use case as shown in your question isn't going to use the variable, I've checked the [√] Ignore this action's input checkbox checked, in the Ask for Finder Items action. Of course adjust to your needs.
Now to pass both what's returned by the Ask for Finder Items action and the value of the Variable_1
variable, place a Get Value of Variable action between the Ask for Finder Items action and the Run AppleScript action.
Then in this case, input
in on run {input, parameters}
is a list of two items, the first being what was passed from the Ask for Finder Items action and the second being the value of the Variable_1
variable from the Get Value of Variable action, and here's an example AppleScript code addressing what is shown in your Run AppleScript action to handle it:
on run {input, parameters}
set filePath to the POSIX path of item 1 of input
set Answer to item 2 of input -- This is the value of the Variable_1 variable.
return filePath & Answer
end run
That said, the return
line may not be practical as it's just concatenating two strings at that point, so I suspect this is just for testing to see that it actually can return the two pieces of information.