I am trying to pass a variable that has been set in Automator to an AppleScript within Automator. My Automator workflow is as follows:
Ask for Finder Items (only allowing folder type)
Set Value of Variable (variable set to "chosenfolder")
Get Value of Variable (chosenfolder)
Run AppleScript
property odd : true -- set to false to get odd numbers
on run {input, parameters}
set thefolder to (input as text)
set TheNumber to (odd as integer)
tell application "Finder"
set FileList to every file of thefolder
repeat with oneFile in FileList
set Ex to name extension of oneFile
set NameString to text -4 thru -1 of ("000" & TheNumber) & "." & Ex
set name of oneFile to NameString
set TheNumber to TheNumber + 2
end repeat
end tell
return input
end run
This returns the error:
Can’t get every file of "Macintosh SSD:Users:etc....
Does anyone have any suggestions as to why the chosen folder in automator cannot be accepted in the AppleScript?
Note: I understand that I can just use "choose folder" in the AppleScript instead of using the Automator workflow items, but I truncated my actual workflow just to show this portion. The variable is needed elsewhere in the Automator workflow in addition to passing it to the AppleScript.