Re: AppleScript little problem...
Re: AppleScript little problem...
- Subject: Re: AppleScript little problem...
- From: "Rakesh Pandey" <email@hidden>
- Date: Tue, 17 Dec 2002 01:12:12 +0530
Yeah you can pass an argument(parameter) with your command and fetch it in
your code like this:
@implementation NSApplication(MyAppScripting)
- (id)handleSendCommand:(NSScriptCommand *)command
{
id directParam = [command directParameter] ;
// Now you have the parameter in directParameter ...do whatever you want now
...
// do some stuff
}
regards
Rakesh
----- Original Message -----
From: "Nico" <email@hidden>
To: <email@hidden>; <email@hidden>
Sent: Tuesday, December 17, 2002 12:50 AM
Subject: AppleScript little problem...
>
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.