Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)
Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)
- Subject: Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)
- From: Christopher Nebel <email@hidden>
- Date: Wed, 18 Oct 2006 10:00:52 -0700
On 2006-10-15, at 07:44:19, Hiroshi T. wrote:
I wrote an Applescript to convert music file format in iTunes. There are many options for conversion and currently the script asks every option in the 'display dialog'. Some of these options are of frequent use and I want to do them by one click. My envisioned solution to implement this mechanism is to make symbolic links to the script and call them in the 'iTunes Script Menu'. For this to work, I need '$0'-equivalent in Applescript. Namely, the script is to obtain the name of file off which it is launched and changes what it does according to the file name.
I'd tell you to use "path to me", but it won't do what you want -- at least not currently. The problem is that the symlink gets resolved before running the script, so they'll all come out pointing to the original.
The problem with Philip's solution, at least as written, is that you wind up with lots of identical copies of the base HiroConvert application. This is not hard to work around, though -- just put HiroConvert somewhere outside the scripts. You may have to manually find it once for the scripts to work, but after that they should be fine. This is less than ideal for distribution, but for your own personal use it doesn't matter much.
--Chris Nebel AppleScript Engineering
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden