Re: Why won't this call a method in AppDelegate?
Re: Why won't this call a method in AppDelegate?
- Subject: Re: Why won't this call a method in AppDelegate?
- From: Shane Stanley <email@hidden>
- Date: Wed, 17 Dec 2014 15:25:37 +1100
On 17 Dec 2014, at 1:23 pm, Brian Christmas <email@hidden> wrote:
>
> Shane, my apologies, I’m not explaining myself very well.
>
> I’m not after the value of a variable, you’ve already told me how to use a method on how t o do that, but I want to RUN a method in AppDelegate’s script, calling it from a script which has been itself called from AppDelegate.applescript.
I understand what you're after; you're misunderstanding the point.
You have a script called AppDelegate.applescript. When you launch your app, that is the basis for a class called AppDelegate. And your application then creates an *instance* of that class, which becomes the application's delegate. You keep trying to talk to the class. You can do that, as long as it's something simple -- methods appear as both class methods and instance methods. But if something in that method accesses something that belongs to the application delegate instance, the only way it makes any sense is to address that particular instance -- not the class.
If you don't grasp the difference between a class and an instance, you're going to be having this sort of problem again and again.
For the actual problem in the script you didn't expect to work, I suggest you go back to my book and read the chapter "Handlers as Methods" on page 183 -- it's short and largely on the very issue you're striking. Look at the last script on page 184. Notice how the handler has a single argument, which it then coerces.
--
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