• 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: Handlers in applications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handlers in applications


  • Subject: Re: Handlers in applications
  • From: Paul Berkowitz <email@hidden>
  • Date: Sat, 12 Feb 2005 09:29:12 -0800

Title: Re: Handlers in applications
On 2/12/05 9:17 AM, "Irwin Poche" <email@hidden> wrote:

There has to be a simple solution to this but it eludes me.

It appears that applications can't deal with simple condition handlers.  This example issues an Applescript Error "TextEdit got an error: Can't continue simplicity."  Same result for iPhoto 5.0.1 and iTunes...

tell application "TextEdit"
        activate
        simplicity("testing")
end tell

on simplicity(xxx)
        display dialog xxx
end simplicity

but this works...

    
simplicity("testing")

on simplicity(xxx)
        display dialog xxx
end simplicity

The first example will work by using a tell me to before simplicity but that seems unnecessary and kludgy.


It's time for you to read the AppleScript Language Guide, or a good book on AppleScript like Matt Neuburg's AppleScript: The Definitive Guide.

This is all part of the AppleScript language. Anything in a tell block "belongs" to the targeted application or object, And the application does not "own" your handlers, the script does. You simply need to preface the handler call with 'my'.  ('my' or 'me' refers to the script.)

        
tell application "TextEdit"
       activate
        my simplicity("testing")
end tell
 
will work just fine. There's nothing to stop you using 'my' all the time (even when not in a tell block) if you find it easier to not have to remember when to use it.

--
Paul Berkowitz
 _______________________________________________
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: 
 >Handlers in applications (From: Irwin Poche <email@hidden>)

  • Prev by Date: Re: Handlers in applications
  • Next by Date: Re: Handlers in applications
  • Previous by thread: Re: Handlers in applications
  • Next by thread: Re: Handlers in applications
  • Index(es):
    • Date
    • Thread