Re: [SOLVED: Better] Getting file paths
Re: [SOLVED: Better] Getting file paths
- Subject: Re: [SOLVED: Better] Getting file paths
- From: Killobit <email@hidden>
- Date: Wed, 28 Sep 2005 04:57:14 -0700
i just further refined the AS to just these lines:
tell application "Finder"
try
return the URL of target of front window
on error
return the URL of desktop
end try
end tell
the script below is probably much better, but the script above does
what i want to do
in minimal amounts of AS code
Thanks again for "jump starting" me jay :)
Regards,
Eric
On Sep 28, 2005, at 4:39 AM, Killobit wrote:
THANK YOU!
i modified the code a bit to work the way i needed, for future
reference here's the code:
on run
try
tell application "Finder"
--attempt to get the URL of the front winodw (path)
set thePath to URL of target of front window
return thePath
end tell
on error error_name number error_number
if (error_number = -1728) then -- no front window open
try
-- now lets, just get the path to the desktop folder
tell application "Finder"
set thePath to URL of desktop
end tell
on error error_name number error_number -- some other
error occurred, report it
return "Error name:" & return & error_name & return
& return & "Error number: " & error_number
end try
end if
end try
end run
but one more quick question,
is it "bad form" to have a double try like that? or is there
another way to do that?
thanks again
Eric
_______________________________________________
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