Re: Name of this folder
Re: Name of this folder
- Subject: Re: Name of this folder
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 11 Mar 2001 17:47:46 -0800
On 3/11/01 5:09 PM, "Nigel Garvey" <email@hidden> wrote:
>
Paul Berkowitz wrote on Sun, 11 Mar 2001 11:57:19 -0800:
>
>
> On 3/11/01 10:36 AM, "Bryan Harris" <email@hidden> wrote:
>
>
>
>>> Explanation:
>
>>>
>
>>> ":" as alias
>
>
>> This just returns "Applescript" for me. Does it only work when running
>
> from
>
>> other apps?
>
>>
>
> You must be running it from Script Editor. Sander was using it in an applet
>
> (script application), but didn't say so. This sort of thing happens quite a
>
> lot here.
>
>
>
> Similarly with Bill Briggs' 'path to me' solution. They both presuppose that
>
> the script in question is an application. If it is, then their solutions
>
> will work. I'm not sure that Robert, who first asked the question, realized
>
> that, nor did he say whether his script is
>
[...]
>
>
> 1) A script application (applet/droplet) will return its container (folder)
>
> alias.
>
>
>
> 2) A compiled script running from OSA menu behaves like an application in
>
> this and other regards: Leonard Rosenthol (who makes OSA menu) has made it
>
> so, which is very handy.
>
>
Actually, with OSA Menu, while 'path to me' returns the path to the
>
compiled script, '":" as alias' (or '"" as alias') returns the path to
>
the folder of the application to which OSA Menu has passed the script -
>
normally the application that was frontmost when the script was selected
>
from the menu - which can also be very handy. (I must try writing shorter
>
sentences.)
Very good. I hadn't tried that, but it resembles a lot of the behaviour of
Leonard's OneClick which frequently wraps scripts in an uncalled "current
application" (the front application).
>
>
tell (a reference to Richard23)
>
text of "Hey, Artoo. What's this application's folder?" as string
>
end tell
>
display dialog (the alias result as string)
>
:-) It seems to me you forgot a crucial element in your example:
tell (a reference to Richard23)
try
get its contents
on error
text of "Hey, Artoo. If you ain't got any content, at least tell us
this application's folder?" as string
end try
end tell
display dialog (the alias result as string)
--
Paul Berkowitz