• 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: declaring new apple script commands
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: declaring new apple script commands


  • Subject: Re: declaring new apple script commands
  • From: Pascal Pochet <email@hidden>
  • Date: Sat, 1 Jun 2002 10:34:49 +0200

Hi,

I'd like to have those scripts working

"select first word of myText"
"select middle word of myText"
"select characters 3 through 5 of myText"
...

I already have subclassed NSScriptCommand in MySelectScriptCommand. Its default implementaion just logs something in the console but it is details.

I declared the command in the script suite, but i could not find my way to make any object sensitive to this command. I declared the command in the SupportedCommands section of an NSCoreSuite.AbstractObject subclass, but it does not work either.
the script editor always says that the receiver cannot handle that command, however, it can read the "select" command in the app dictionary

This error may happen for variouses reasons:
- you don't have the handler of the command declared correctly or at the right place;
- you have a misspelling somewhere in the script suite or the terminology (event code and class code are case sensitive, a type mismatch is easy);
- the script suite and the terminology are not in sync;
- you have defined terminology conflicting with core ones and the event is not sent to the right object (and by consequence your handler is never called) - sometimes adding () at the right place in the script may solve the problem but it will remain a user level annoyance;
-


BTW, subclassing NSScriptCommand is not mandatory for most AppleScript support in Cocoa, so maybe you have also mix-up things about what to do exactly:
when you do "select first word of MyText" what is myText in term of AS object ?
A AS variable ? a property of a document ?
In any case it's the object that will receive the AE: it must be a class in your Cocoa application and this isthe class in which you should declare the handler and to be identified correctly in scripts you should implement a
- (NSScriptObjectSpecifier *)objectSpecifier
method for it


If you want more help you should post the script suite and terminology.

Pascal
_______________________________________________
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.

References: 
 >declaring new apple script commands (From: jerome LAURENS <email@hidden>)

  • Prev by Date: Re: isa
  • Next by Date: Customization NSRulerView
  • Previous by thread: declaring new apple script commands
  • Next by thread: Re: isa
  • Index(es):
    • Date
    • Thread