• 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: OK, so how *do* you create (and expose) an Applescript dictionary to scripters?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OK, so how *do* you create (and expose) an Applescript dictionary to scripters?


  • Subject: Re: OK, so how *do* you create (and expose) an Applescript dictionary to scripters?
  • From: Don Briggs <email@hidden>
  • Date: Wed, 23 Jul 2003 13:40:18 -0700

What steps are missing?

First, see the docs at
/Developer/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/ Scriptability

For some example Project Builder projects, see:
http://homepage.mac.com/donbriggs

If you're starting a project from scratch, and have scriptability as requirement, it can actually be easier.

Be sure to make your application scriptable by setting
NSAppleScriptEnabled = YES
and
NSPrincipalClass = YourPrinciplaClass
in the project's Info.plist.

If you're grafting scriptability onto an existing project, well, it depends...
If the existing project
 does NOT adhere to Key-Value Coding guidelines (on the naming of instance variables and their accessors);
 is multi-document AND is not NSDocument-based; or
 is non-trivial in complexity AND does not follow the Model-View-Controller design pattern;
then you may have some re-work to do.

If the existing project
 adheres to KVC, or can conform readily;
 is NSDocument-based or has no documents; and
 largely follows the Model-View-Controller design pattern;
then you may be in good shape.

Here's the hurdle -- it's not that high:
For Cocoa (Java or Objective-C), you need to provide some bonus resource for the project to specify the suite.
This resource can be a pair of files (Property Lists, or plists)
{*.scriptSuite, *.scriptTerminology}
either in
> the older ASCII property list format, typically using TextEditor; or
> in XML form, using Property List Editor
Alternatively, this resource can be a single xml file in the new sdef format, which can specify a one or more suites.

The suite's plists must obey some constraints. See:
/Developer/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/ Scriptability/Tasks/SuiteDefs.html

Some of the constraints are obscure. Use the Suite Modeler application, also at
http://homepage.mac.com/donbriggs
in free Demo mode to check your suite's plists. It has "Damage Control" features.

If you're starting a project from scratch, Suite Modeler in Licensed mode can emit "rapid prototype" code
to support your suite. It also emits the suite's plists.

Regards,
Don

On Wednesday, 2003 July, 23, at 04:36AM, Charles Arthur wrote:

I've seen the phrase used often - about exposing the AS dictionary so that
scripters can make use of it. (I think most recently by one of the Johns..
which should be broad enough to be true.)

OK, then, how does one do this with Project Builder etc? Perhaps this is
the wrong list to ask on (in which case, do redirect me).

For example, I like an app called Egg Timer, whose source is available at
http://homepage.mac.com/estebanuribe/software/eggtimer.html

But.. it's written in Obj-C. (Or just C++ - how would I know the
difference?) Examining it in PBuilder, there's no ApplescriptKit. Fine, so
I add that and compile. Still doesn't create an AS dictionary.

What steps are missing here? It's the sort of app that would be nice to
make scriptable, since you could then do stuff with key combos from
anywhere on the system, rather than having to go to the app to set up
reminders etc.

And of course the general applicability of being able to add an AS
dictionary to the many open-source apps would be a much more useful, and
potentially powerful, lesson.

You're going to tell me it's harder than that, aren't you?

Charles
--
----------------------------
http://www.ukclimbing.com : 1100+ British crags, 350+ British climbing
walls - searchable by distance and anything else you care to think of -
with weather forecasts for every one, plus maps, articles, news and
features. And there's even a cool shop attached.

_______________________________________________________________________ _
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
_______________________________________________________________________ _
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >OK, so how *do* you create (and expose) an Applescript dictionary to scripters? (From: Charles Arthur <email@hidden>)

  • Prev by Date: Re: Why is AS so poorly documented?
  • Next by Date: Re: Universal Date Entry (was: Date - 1 day in Address Book)
  • Previous by thread: Re: OK, so how *do* you create (and expose) an Applescript dictionary to scripters?
  • Next by thread: Re: OK, so how *do* you create (and expose) an Applescript dictionary to scripters?
  • Index(es):
    • Date
    • Thread