• 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: Calling a handler from another script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling a handler from another script


  • Subject: Re: Calling a handler from another script
  • From: Shane Stanley <email@hidden>
  • Date: Wed, 24 Jun 2015 09:43:14 +1000

On 24 Jun 2015, at 7:01 am, Stan Cleveland <email@hidden> wrote:

Is the failure because the subclass script is passing the parameter as (I'm guessing) a CFString?

It is being passed as an NSString, but that's not the issue -- you're passing it to a method that wants an NSString anyway.

There are a couple of things. First, you can't make a subclass of an AS-based class. It doesn't generate an error, but there's no inheritance -- your second class ends up just another subclass of NSObject.

But the clue is in the error message:

Ctrlr[4168:303] *** +[CtrlrAppDelegate buttonSetImage:]: unrecognized function setImage_. (error -10000)

See the + sign? That means you are addressing the CtrlrAppDelegate *class*, calling a class method. And that's what your code shows, too. But in a class, properties are meaningless, so myButton will have no value -- hence the problem with setImage_. You want to address your *instance* of CtrlrAppDelegate. So you need a property that refers to the CtrlrAppDelegate instance, or you can also address it like this:

tell current application's NSApp's delegate()'s to buttonSetImage_("Green")

(You don't need the extension for named images.)

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Calling a handler from another script (From: Stan Cleveland <email@hidden>)

  • Prev by Date: Calling a handler from another script
  • Next by Date: Re: Calling a handler from another script
  • Previous by thread: Calling a handler from another script
  • Next by thread: Re: Calling a handler from another script
  • Index(es):
    • Date
    • Thread