calling method in main delegate from outside class? Weird results?

I am attempting to call a method which is in my mainAppDelegate from another applescript file within the same project.

I left the method inside the mainAppDelegate because there is something like 50 variables which is set by the user in the mainmenu.xib

In the applescript file with the call I am using


current application's mainAppDelegate's methodCall()

In the mainAppDelegate’s.applescript file my method is as such:


on methodCall()
log "in"
...
a bunch of code that writes a tabbed text file
---
log "out"
end methodCall

What I am ending up with is the method call fires, it logs “in”… then logs “out”… it doesnt build the tabbed file…
What is strange is that if I call the method from inside the mainAppDelegate… it runs fine.

Any thoughts? What am I missing?!

When you do that, you’re calling methodCall() as a class method – you’re calling it on the class. What you probably want to do is run it on your particular instance of mainAppDelegate, in which case you can use:

current application's NSApp's delegate()'s methodCall()

Ah, thank you Shane I will give it a try!