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 On Sep 28, 2005, at 4:10 AM, Jay Louvion wrote: le 28/9/05 13:03, Killobit à email@hidden est réputé(e) avoir écrit :
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
|