Pass Command-Line Arguments to AppleScripts

According to the osascript man page:

Not sure why, but your method does not work for me.

It returns the following error:

Any clue as to why this would occur ?


(sorry to dig up an old thread)

Model: 800MHz G3 iBook
AppleScript: 1.9.3
Browser: Safari 312
Operating System: Mac OS X (10.3.9)

It works fine on my Tiger machine but not on the Jaguar one. I see you’re using Panther. Maybe the passing of parameters with osascript has only just been introduced.

Thanks. =)

That would seem to be the case.

I had wondered why I hadn’t come across this previously, I guess it would be because it is newly introduced.

As this was not a complete solution, this topic was moved to Mac OS X category.

I think it is a complete solution as long as the following disclaimer is added (copied directly from the osascript man page included in Mac OS X 10.4):


yeah, it works as advertised on 10.4. Here’s another real-world example. I have this as a file (I think I did a chmod +x on it), called “play”

[code]on run argv
set this_DVD to alias (POSIX file argv)

tell application “DVD Player”
open VIDEO_TS this_DVD
– set viewer full screen to true --uncomment this line to get fullscreen

  play dvd

end tell
end run[/code]
and I pass the argument (the VIDEO_TS path) as:

osascript /path/to/some_folder/play /path/to/that/VIDEO_TS

which is called by a tcl script.