• 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: AppleScript little problem...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript little problem...


  • Subject: Re: AppleScript little problem...
  • From: Nico <email@hidden>
  • Date: Mon, 16 Dec 2002 21:38:09 +0100

The problem is exactly that if I pass and argument, the handleSendCommand isn't called anymore ! :(
I got a NSCannotCreateScriptCommandError from script editor :\

Any thoughts ?
Nico.


On lundi, dic 16, 2002, at 20:44 Europe/Paris, Glenn Howes wrote:

In your handleSendCommand message, what do you get if you:

-(id)handleSendCommand:(NSScriptCommand*)command
{
NSDictionary *args = [command evaluatedArguments];
NSLog([args description]);
}

Also, shouldn't the NSObject in the following be an NSString?
<key>AppleEventCode</key>
<string>Strn</string>
<key>Optional</key>
<string>NO</string>
<key>Type</key>
<string>NSObject</string>
</dict>




On Monday, December 16, 2002, at 01:20 PM, Nico wrote:

Hi !

I partially made my app scriptable. Let me explain : you can type the
"typein" command in script editor, but you can't add an argument.
I've seen numerous examples, but still no luck.

Here are the .scriptSuite, .scriptTerminology and the NSApplication
category i use.
Can you tell me if it's possible just to pass an argument so that the
user can use
tell application "MyApp" too typein "boo"

Any help is *very* appreciated :-)
Thanks in advance.
Nico
---





.scriptSuite
<plist version="1.0">
<dict>
<key>AppleEventCode</key>
<string>AKWA</string>
<key>Classes</key>
<dict>
<key>NSApplication</key>
<dict>
<key>AppleEventCode</key>
<string>capp</string>
<key>Superclass</key>
<string>NSCoreSuite.NSApplication</string>
<key>SupportedCommands</key>
<dict>
<key>TypeIn</key>
<string>handleSendCommand:</string>
</dict>
<key>ToManyRelationships</key>
<dict>
<key>orderedDocuments</key>
<dict>
<key>AppleEventCode</key>
<string>docu</string>
<key>Type</key>
<string>AKDocument</string>
</dict>
</dict>
</dict>
</dict>
<key>Commands</key>
<dict>
<key>TypeIn</key>
<dict>
<key>AppleEventClassCode</key>
<string>AKWA</string>
<key>AppleEventCode</key>
<string>Rvrs</string>
<key>Arguments</key>
<dict>
<key>text</key>
<dict>
<key>AppleEventCode</key>
<string>Strn</string>
<key>Optional</key>
<string>NO</string>
<key>Type</key>
<string>NSObject</string>
</dict>
</dict>
<key>CommandClass</key>
<string>NSScriptCommand</string>
<key>ResultAppleEventCode</key>
<string>Strn</string>
<key>Type</key>
<string>NSString</string>
</dict>
</dict>
<key>Name</key>
<string>MyApp</string>
<key>Synonyms</key>
<dict>
<key>tact</key>
<string>NSTextSuite.NSTextStorage</string>
</dict>
</dict>




.scriptTerminology
<dict>
<key>Classes</key>
<dict>
<key>NSApplication</key>
<dict>
<key>Description</key>
<string>AkwaIRC's top level scripting object.</string>
<key>Name</key>
<string>application</string>
<key>PluralName</key>
<string>applications</string>
</dict>
</dict>
<key>Commands</key>
<dict>
<key>TypeIn</key>
<dict>
<key>Arguments</key>
<dict>
<key>text</key>
<dict>
<key>AppleEventCode</key>
<string>Strn</string>
<key>Type</key>
<string>NSObject</string>
<key>Description</key>
<string>fuka string</string>
<key>Name</key>
<string>text</string>
</dict>
</dict>
<key>Description</key>
<string>Send some text to the current window.</string>
<key>Name</key>
<string>typein</string>
</dict>
</dict>
<key>Description</key>
<string>AkwaIRC specific classes.</string>
<key>Name</key>
<string>AkwaIRC suite</string>
<key>Synonyms</key>
<dict>
<key>tact</key>
<dict>
<key>Description</key>
<string>The textual contents of a text area graphic.</string>
<key>Name</key>
<string>text contents</string>
</dict>
</dict>
</dict>




and the category :-)
@interface NSApplication (AKScripting)
- (id)handleSendCommand:(NSScriptCommand *)command;
@end

@implementation NSApplication(MyAppScripting)
- (id)handleSendCommand:(NSScriptCommand *)command
{
// do some stuff
}
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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 little problem...
      • From: Greg Titus <email@hidden>
References: 
 >Re: AppleScript little problem... (From: Glenn Howes <email@hidden>)

  • Prev by Date: Can run on read only vol
  • Next by Date: Re: "First Run" installation of Application support stuff?
  • Previous by thread: Re: AppleScript little problem...
  • Next by thread: Re: AppleScript little problem...
  • Index(es):
    • Date
    • Thread