• 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: Cannot return string from handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Cannot return string from handler (From: Ruth Bygrave <email@hidden>)

  • Prev by Date: Re: IPTC Data
  • Next by Date: Re: Cannot return string from handler
  • Previous by thread: Re: Cannot return string from handler
  • Next by thread: Re: Cannot return string from handler
  • Index(es):
    • Date
    • Thread