Re: Making Cocoa Application Scriptable
Re: Making Cocoa Application Scriptable
- Subject: Re: Making Cocoa Application Scriptable
- From: Andrei Tchijov <email@hidden>
- Date: Sat, 19 Aug 2006 16:40:08 -0400
Matt,
Thanks a lot for tutorial link. This tutorial + SDEF they get me
going. I am almost happy with end result of this efforts, the only
problem is "... whose name is ..." statement. In my application I
have "scriptable" variable "profiles". I can do things line "profile
x" or "count profiles" or "name of every profile", but when I try to
do "profile whose name is "..."", I am getting error that such
profile could not be found.
I have not implemented methods like "countOfProfiles" and
"objectInProfilesArrayAtIndex" yet. Will these methods help?
You comments will be highly appreciated.
Andrei Tchijov
On Aug 19, 2006, at 12:53 PM, Matt Neuburg wrote:
Now that we have sdefs, you may find it easier and more dependable
to build
your dictionary using Sdef Editor (and you can then, if necessary for
backwards compatibility, do the bulk of the transformation to
scriptSuite/scriptTerminology using sdp). Another thing to watch
out for is
this: when editing your app's plist, always use Property List
Editor, since
if you edit it as text ("by hand") you will certainly make a
mistake, and
there is no warning (things will just mysteriously fail).
Apart from this the only suggestion I have is that you restart your
computer
(this does, I think, sometimes help in trying to get Script Editor
to open
its eyes).
There are many online tutorials showing you how to get started adding
scriptability to your app, including mine:
<http://www.tidbits.com/matt/scriptability/scriptabilityTutorial.html>
m.
On Sat, 19 Aug 2006 07:55:13 -0400, Andrei Tchijov
<email@hidden>
said:
Hi,
I think I am missing something very important, but I can not see
what. I am trying to make my application AppleScript Scriptable. I
was under impression that once you created proper *.scriptSuite and
*.scriptTerminology you should be able to see it in your app
dictionary in Script Editor. I can not. Below are MyApp.scriptSuite/
scriptTerminology. I reduced it to single class NSApplication with
single attribute and it still does not work. Can someone please take
a look and tell me what am I doing wrong:
You help will be highly appreciated,
Andrei Tchijov
P.S. I do have <key>NSAppleScriptEnabled</key><string>YES</string> in
my plist and MyApp.scriptSuite/scriptTerminology are get copied into
Contents/Resources folder inside my app.
<?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>Name</key>
<string>MyApp</string>
<key>AppleEventCode</key>
<string>avpn</string>
<key>Classes</key>
<dict>
<key>NSApplication</key>
<dict>
<key>AppleEventCode</key>
<string>capp</string>
<key>Superclass</key>
<string>NSCoreSuite.NSApplication</string>
<key>Attributes</key>
<dict>
<key>oneAttribute</key>
<dict>
<key>AppleEventCode</key>
<string>aone</string>
<key>Type</key>
<string>NSString</string>
</dict>
</dict>
</dict>
</dict>
</dict>
</plist>
<?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>Name</key>
<string>MyApp</string>
<key>Description</key>
<string>MyApp Scripting Suite</string>
<key>Classes</key>
<dict>
<key>NSApplication</key>
<dict>
<key>Name</key>
<string>application</string>
<key>PluralName</key>
<string>applications</string>
<key>Description</key>
<string>Top Applicaiton</string>
<key>Attributes</key>
<dict>
<key>oneAttribute</key>
<dict>
<key>Name</key>
<string>oneAttribute</string>
<key>Description</key>
<string>one attribute</string>
</dict>
</dict>
</dict>
</dict>
</dict>
</plist>
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden