I want to use an Automator variable in Applescript (inside of Automator) but I didn't find any info online on how to do it. This is my Automator project, and here is the Applescript:
tell application "Finder"
delete file Path
empty trash
end tell
end run
Automator is scriptable, so in a workflow you can just use its terms, for example:
set thePath to value of variable "Path" of front workflow
tell application "Finder"
delete file thePath
empty trash
end tell
Note that path
is a parameter name, so I used a different variable name for it in the script.
Another option is to use Get Value of Variable
and pass it on to the Run AppleScript
action, for example:
Ask for Text
Set Value of Variable {Variable: Testing}
-- other workflow stuff --
Get Value of Variable {Variable: Testing} (Ignore Input)
Run AppleScript
on run {input, parameters} -- input is from the previous action
set theValue to (first item of input) as number -- input is always a list
if theValue > 1 then display dialog "It works!"
-- return item(s) to the next action as needed
end run