Re: Cannot return string from handler
Re: Cannot return string from handler
- Subject: Re: Cannot return string from handler
- From: dev_sleidy <email@hidden>
- Date: Fri, 5 May 2006 09:39:18 -0400
on init()
tell application "Finder"
if disk "Disgo" exists then
set myTarget to "Disgo"
end if
return myTarget
end tell
end init
... fails to address the situation when 'Disgo' is not mounted; and
thus, 'myTarget' is not declared or set, causing an AppleScript error
when 'return myTarget' is called.
on init()
set myTarget to ""
tell application "Finder" to if disk "Disgo" exists then set
myTarget to "Disgo"
return myTarget
end init
my init()
... returns "", if 'Diskgo' was not mounted, when the code executed.
Code to consider ...
on init(disk_name)
set myTarget to ""
tell application "Finder" to if disk disk_name exists then set
myTarget to disk_name
return myTarget
end init
If (my init("Disgo") = "") then
...
else
...
end
_______________________________________________
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