Re: How to get name of classic app
Re: How to get name of classic app
- Subject: Re: How to get name of classic app
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 15 Sep 2001 13:04:44 -0700
On 9/15/01 12:54 PM, "Rob Jorgensen" <email@hidden> wrote:
>
On 09/15/2001, Irwin Poche commented:
>
>
> How can a script saved as a classic applet get it's name ?
>
>
>
> I have tried every combination of me, my, and name I can think of. For
>
> instance...
>
>
>
> me
>
> name of me
>
> name of me as text
>
> my name
>
> tell me to get my name
>
> etc...
>
>
This works for me:
>
>
tell application "Finder" to set myName to (name of (path to me as alias))
>
display dialog myName
>
>
But it's not safe to put 'path to me' in a Finder tell block. Odd things can
happen. (And you don't really need "as alias": that's the default.)This
would be safer:
set myPath to (path to me)
tell application "Finder" to set myName to (name of myPath)
display dialog myName
Another method:
set myPath to (path to me as string)
set {tids, AppleScript's text item delimiters} to {AppleScript's text
item delimiters, {":"}} -- one line
set myName to last text item of myPath
set AppleScript's text item delimiters to tids
display dialog myName
--
Paul Berkowitz