Dumb First Time Apple Scripting question. (kind of long. rtf)
Dumb First Time Apple Scripting question. (kind of long. rtf)
- Subject: Dumb First Time Apple Scripting question. (kind of long. rtf)
- From: Charles Bennett <email@hidden>
- Date: Tue, 2 Apr 2002 16:36:48 -0500
Hi all, I'm trying to figure out how to add Apple Script to an very
simple application.
Kind of a Hello World for scripting..
This is the first time I've tried this so my ignorance level is, no
doubt, staggering ;-)
I have, and am, reading the "Scriptability" documents but am obviously
missing something fundamental.
My simple test app is not multi document. There is a a single object
that I want to set and get a variable from. It is a singleton and is
created
by my apps delegate and is pointed to by the apps delegate fooClass
variable
This class called FooClass and it has an integer variable fooVar.. very
simple
the important part of the headers
//apps delegate..
@interface MainController : NSObject {
FooClass *fooClass;
}
//FooClass header..
@interface FooClass : NSObject {
int fooVar;
}
- (void) setFooVar:(int) newFooVar;
- (int) fooVar;
The application compiles. ScriptEditor reads my dictionary just fine
(the app launches when this happens..) The dictionary in the
script editor shows this..
application shows
fooClass by numeric index, before/after another element, as a range
of elements, satisfying a test
Properties:
<Inheritance> application [r/o] -- All of the properties of the
superclass.
and fooClass
Class fooClass: a FooClass.
Properties:
fooVar integer -- The fooVar
looks good to me :-)
But trying to set or get the fooVar doesn't seem to work.
I'm new enough to Apple Script that I don't know what I don't know ;-)
so if there is a "Fine Manual" or a "simple" example that I've missed
just let me know. I do have the AppleScript Language guide.
Thanks all..
Chuck
This is my script terminology..
{
"Name" = "AppleScriptTest suite";
"Description" = "AppleScriptTest specific classes.";
"Classes" = {
"NSApplication" = {
"Name" = "application";
"PluralName" = "applications";
"Description" = "AppleScriptTest top level scripting
object.";
};
"FooClass" = {
"Name" = "fooClass";
"Description" = "a FooClass.";
"Attributes" = {
"fooVar" = {
"Name" = "fooVar";
"Description" = "The fooVar";
};
};
};
};
}
this is my script suite
{
"Name" = "AppleScriptTest";
"AppleEventCode" = "asts";
"Classes" = {
"NSApplication" = {
"Superclass" = "NSCoreSuite.NSApplication";
"ToOneRelationships" = {
"fooClass" = {
"Type" = "FooClass";
"ReadOnly" = "YES";
"AppleEventCode" = "fooc";
};
};
"AppleEventCode" = "capp";
};
"FooClass" = {
"Superclass" = "NSObject";
"AppleEventCode" = "fooc";
"Attributes" = {
"fooVar" = {
"Type" = "NSNumber";
"ReadOnly" = "NO";
"AppleEventCode" = "foov";
};
};
};
};
}
the script
tell application "AppleScriptTest"
tell fooClass
copy 5 to fooVar
end tell
end tell
_______________________________________________
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.