Hi Duffman,
The current durectory in AppleScript is the folder for the current application that’s running the statements of the script. If I type this in the terminal (and I’m a newbie with this app :-)):
osascript -e ‘run script “path to me”’
I get this:
alias Macintosh HD:usr:bin:osascript
When you use just the name of a file in the reference like:
file “a.app”
this is called a partial reference. When AppleScript gets a partial reference, it tries to complete that reference by looking to the current application. By theory, it should look in:
alias Macintosh HD:usr:bin:
for the script a.app. Anyway, if you placed the script there in the bin folder, then it should work. Hope I’m getting this right with the osascript thing.
There are several ways to make a complete reference so that AppleScript knows where to look for the script. In AppleScript, the path to the file begins with the startup disk (Macintosh HD in my case) and ends with the file or folder. Items are separated by colons. So the path to my script on the desktop would be:
“Macintosh HD:Users:kel:Desktop:ParamScript”
and adding file or alias at the beginning makes it a reference:
file “Macintosh HD:Users:kel:Desktop:ParamScript”
Note that "ParamScript is the name of my script file.
Other ways to make the reference are use the ‘path to’ command with concatenation, use the Finder, use ‘posix path’, use colon, etc. It gets deeper when you use Finder references. Here’s one for your script which is located on the desktop and you can use in the terminal besides the reference mentioned above.
osascript -e ‘run script file (“” & (path to desktop) & “ParamScript”) with parameters {“hi”}’
gl,