Re: Getting file paths
Re: Getting file paths
- Subject: Re: Getting file paths
- From: Jay Louvion <email@hidden>
- Date: Wed, 28 Sep 2005 13:10:10 +0200
le 28/9/05 13:03, Killobit à email@hidden est réputé(e) avoir
écrit :
> hello list,
>
> I've constructed the following AS:
>
> tell application "Finder"
> set thePath to URL of container of item 1 of front window
> return thePath
> end tell
>
> which gets the path of the current (read front most) Finder window,
> but it has 2 major flaws
>
> 1. it fails if no Finder windows are open
> 2. if fails if the front Finder window has no files in it
>
> I was wondering, how could i fix that so it will "always" work
>
> i've tried checking to see if the "current window" is "desktop
> window" but
> i keep getting "Can't get finder window 1" errors
>
In that case I would throw in a "try" handler.
You can recuperate the kind of mistake, error nomber and then decide what
would want to do in such cases.
try
tell application "Finder"
set thePath to URL of container of item 1 of front window
return thePath
end tell
on error error_name number error_number
display dialog "Error name:" & return & error_name & return & return &
"Error number: " & error_number
end try
HTH
J.
Jay Louvion
Studio Casagrande
3, rue Müller-Brun
1208 Geneva
T+4122 840 3272
F+4122 840 3271
skypeme:
jaylouvion
www.studiocasagrande.com
_______________________________________________
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