• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [SOLVED: Better] Getting file paths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Getting file paths (From: Jay Louvion <email@hidden>)
 >Re: Getting file paths (From: Killobit <email@hidden>)

  • Prev by Date: Re: Getting file paths
  • Next by Date: Memory leak in Script App
  • Previous by thread: Re: Getting file paths
  • Next by thread: Memory leak in Script App
  • Index(es):
    • Date
    • Thread