On 2006-10-14, at 17:24:39, Hiroshi T. wrote: Thanks for your reply. Unfortunately I'm on 10.3.9 and cannot upgrade to Tiger for various reasons such as application compatibility.
There is not much choice in AppleScript in 10.3.9 except for "path to me" in a script saved as an 'application bundle'.
I'm not entirely clear on what you want to accomplish, but you can script application bundles easily with regular scripts:
Here's an application bundle called "doit"
on xxx(theList) display dialog (item 1 of theList) end xxx
on yyy(theRecord) display dialog theRecord's name end yyy
on ptm() return POSIX path of (path to me) end ptm
Here's a regular script calling the "doit" application:
tell application "doit" activate xxx({"Some good thing", "Some bad thing"}) yyy({name:"Hiroshi"}) ptm() end tell
There are other scripting facilities too. Tcl scripting language < x-man-page://tclsh> has AppleScript support (maybe some others like Python and Perl too). My OSA components TclOSA, PerlOSA, PythonOSA, RubyOSA, ShOSA might be of some help, and I believe appscript for Python by Hamish Sanderson has some iTunes scripting examples.
The requirements for 'path to me' in the above script are OS X 10.4 minimum, saved as a script bundle, and that it be run from a suitable executable. There is no problem saving the above script in OS X 10.4.8. But you can not run it in Script Editor.
You can put it in ~/Library/Scripts and run it from the Script menu in the menu bar.
You can run it in Terminal by:
% osascript ptm.scptd
I don't know much about iTunes but you can always run a script which calls 'osascript' to call your script.
|