• 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: Invoking an Objective-C method from an Applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invoking an Objective-C method from an Applescript


  • Subject: Re: Invoking an Objective-C method from an Applescript
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 22 Aug 2005 13:04:23 -0700

On Aug 22, 2005, at 9:01 AM, Robert MacGregor wrote:

I'm trying to invoke an Objective-C method from a Java method within my app using NSAppleScript.:

tell application "CocoaJavaApp"
    call method "msgTest" of class "NSApplication"
end tell

I get this error:

Java Applescript errors:{
NSAppleScriptErrorBriefMessage = "Expected end of line but found identifier.";
NSAppleScriptErrorMessage = "Expected end of line but found identifier.";
NSAppleScriptErrorNumber = -2741;
NSAppleScriptErrorRange = <00000027 00000006 >;
}


When I invoke the method from within my Applescript app it works. Why?

Let me see if I've got this right: you've built a Cocoa-Java application, and you're trying to trigger a method in it from another application using AppleScript (more precisely, calling NSAppleScript to run a script)? Suppressing any comments about how Byzantine this sounds...


"call method" is only defined in applications that link to AppleScriptKit. (There's some Cocoa Scripting magic that happens when you do that.) An AppleScript Studio application does this implicitly; that's part of what using AppleScript Studio means. Other applications don't, so you'll have to add it manually to your Cocoa-Java app. (Actually, I'm not sure that it's that quite that simple -- there may be a method you need to invoke at startup.)


--Chris Nebel AppleScript and Automator Engineering

_______________________________________________
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


  • Follow-Ups:
    • Re: Invoking an Objective-C method from an Applescript
      • From: Robert MacGregor <email@hidden>
References: 
 >Invoking an Objective-C method from an Applescript (From: Robert MacGregor <email@hidden>)

  • Prev by Date: Re: Time to figure out what is going on... (fixed)
  • Next by Date: Re: Invoking an Objective-C method from an Applescript
  • Previous by thread: Re: Invoking an Objective-C method from an Applescript
  • Next by thread: Re: Invoking an Objective-C method from an Applescript
  • Index(es):
    • Date
    • Thread