Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)



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.


Philip Aker


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

References: 
 >Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: "Hiroshi T." <email@hidden>)
 >Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: Philip Aker <email@hidden>)
 >Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: "Hiroshi T." <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.