• 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
AppleScript Support in Cocoa/Java
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScript Support in Cocoa/Java


  • Subject: AppleScript Support in Cocoa/Java
  • From: Moray Taylor <email@hidden>
  • Date: Mon, 17 Nov 2003 10:10:42 +0000

Hi,

I am trying to implement AppleScript support in my Cocoa app, after many, many hours of effort, I got my custom commands to work, woohoo! However, I can only get simple, no argument commands to work, any with an argument I get this error

NSCannotCreateScriptCommandError


I have copied and pasted my scriptsuite and terminology files below, Disconnect, and DoSQL work, openconnection gives me the error.

I am quite experienced with AppleScript, so I don't think my script is the problem

I don't see why simple arguments could cause me such a problem, I'm sure it must be something simple, any ideas?

Many thanks in advance.

Moray


tell app "Lynx"
tell front document
do SQL -- works
disconnect -- works
open connection "whatever" -- gives error
end tell
end tell


This is my scripSuite

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
<key>AppleEventCode</key>
<string>DATP</string>
<key>Classes</key>
<dict>
<key>MyDocument</key>
<dict>
<key>AppleEventCode</key>
<string>docu</string>
<key>Superclass</key>
<string>NSCoreSuite.NSDocument</string>
<key>SupportedCommands</key>
<dict>
<key>Disconnect</key>
<string>handleDemonstrateScriptCommand:</string>
<key>DoSQL</key>
<string>handleDemonstrateScriptCommand:</string>
<key>OpenConnection</key>
<string>handleDemonstrateScriptCommand:</string>
</dict>
</dict>
<key>NSApplication</key>
<dict>
<key>AppleEventCode</key>
<string>capp</string>
<key>Attributes</key>
<dict/>
<key>Superclass</key>
<string>NSCoreSuite.NSApplication</string>
<key>ToManyRelationships</key>
<dict>
<key>orderedDocuments</key>
<dict>
<key>AppleEventCode</key>
<string>docu</string>
<key>Type</key>
<string>MyDocument</string>
</dict>
</dict>
</dict>
</dict>
<key>Commands</key>
<dict>
<key>Disconnect</key>
<dict>
<key>AppleEventClassCode</key>
<string>DISC</string>
<key>AppleEventCode</key>
<string>disc</string>
<key>CommandClass</key>
<string>NSScriptCommand</string>
</dict>
<key>DoSQL</key>
<dict>
<key>AppleEventClassCode</key>
<string>DEMO</string>
<key>AppleEventCode</key>
<string>Demo</string>
<key>CommandClass</key>
<string>NSScriptCommand</string>
</dict>
<key>OpenConnection</key>
<dict>
<key>AppleEventClassCode</key>
<string>OPCO</string>
<key>AppleEventCode</key>
<string>opco</string>
<key>Arguments</key>
<dict>
<key>URL</key>
<dict>
<key>AppleEventCode</key>
<string>pnam</string>
<key>Type</key>
<string>NSObject</string>
</dict>
</dict>
<key>CommandClass</key>
<string>NSScriptCommand</string>
</dict>
</dict>
<key>Name</key>
<string>Lynx</string>
</dict>
</plist>


My terminolgy suite


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
<key>Classes</key>
<dict>
<key>Lynx</key>
<dict>
<key>Attributes</key>
<dict/>
<key>Description</key>
<string>Lynx</string>
<key>Name</key>
<string>Lynx</string>
<key>PluralName</key>
<string>demo apps</string>
</dict>
</dict>
<key>Commands</key>
<dict>
<key>Disconnect</key>
<dict>
<key>Description</key>
<string>Disconnects from the current database.</string>
<key>Name</key>
<string>Disconnect</string>
</dict>
<key>DoSQL</key>
<dict>
<key>Arguments</key>
<dict/>
<key>Description</key>
<string>Demonstrates an AppleScript command handler in Cocoa.</string>
<key>Name</key>
<string>do SQL</string>
</dict>
<key>OpenConnection</key>
<dict>
<key>Arguments</key>
<dict>
<key>URL</key>
<dict>
<key>Description</key>
<string>The database to connect to.</string>
<key>Name</key>
<string>URL</string>
</dict>
</dict>
<key>Description</key>
<string>Open a connection</string>
<key>Name</key>
<string>open connection</string>
</dict>
</dict>
<key>Description</key>
<string></string>
<key>Name</key>
<string>Lynx Suite</string>
</dict>
</plist>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: AppleScript Support in Cocoa/Java
      • From: Don Briggs <email@hidden>
  • Prev by Date: Strange characters in Toolbar
  • Next by Date: Re: Formatter - 2 decimal places
  • Previous by thread: Re: Strange characters in Toolbar
  • Next by thread: Re: AppleScript Support in Cocoa/Java
  • Index(es):
    • Date
    • Thread