My Problem
I have an AppleScript script file called script.scpt.
This is the first line of the script where I'm intending to use labeled parameters (AKA named parameters):
on run given foo:fooStr
I open Terminal and attempt to run the script by typing the following:
osascript "/Users/UserName/Library/Mobile Documents/com~apple~ScriptEditor2/Documents/script.scpt" given foo:"bar"
I get the resulting error:
execution error: The foo parameter is missing for run. (-1701)
I have tried every other variation I can think of for supplying the labeled/named parameter to the script within the command line with no success.
My Question
How do I pass labeled/named parameters to an existing AppleScript script file via the command line? Thanks in advance.
Background
I previously had the script using the following line:
on run argv
And then did things the "typical" way by getting values I needed within my script based on their predetermined sequential position when supplied on the command line as such:
set fooStr to item 1 of argv
Where the command line was:
osascript "/Users/UserName/Library/Mobile Documents/com~apple~ScriptEditor2/Documents/script.scpt" "bar"