AppleScript to make different document types
AppleScript to make different document types
- Subject: AppleScript to make different document types
- From: John Nairn <email@hidden>
- Date: Mon, 15 Sep 2003 16:11:18 -0600
Default apple scripting is set up for standard multidocument interface,
but my application has two types of documents and I would like to be
able to create each type with "make new firsttype document at front" or
"make new firsttype document at front".
Here is my current trial and error process:
Method 1:
First document class
AppleEventCode docu
Superclass NSCoreSuite.NSDocument
Second document class
AppleEventCode docR
Superclass NSCoreSuite.NSDocument
Results: I can make first document type with standard make command, but
not the second. This method also lead to a result I do not understand
(and did not look right). The scipting dictionary of the app lists the
second document type as inheriting all properties of the first type
even though the first is not its superclass?
Method 2:
First document class
AppleEventCode docC
Superclass NSCoreSuite.NSDocument
Second document class
AppleEventCode docR
Superclass NSCoreSuite.NSDocument
Now each document class inherits correctly, by make commands do not
work for either type. There is no AppleScript error, the make new
document command just does nothing or it creates no window or document.
If I check the count of documents after a make new document command, it
reports some documents exist and the front document has class
"document". Some code has apparantly inserted an NSDocument into
orderDocuments but never did anything else.
There must/should be way to intercept the make new document command for
this custom application, but I can not figure out how the make command
happens for documents. The NSDocument class supports make through
NSAbstractObject, but that command (Create) is not directed to any
handler. Is there any explanation of what happens?
------------
John Nairn (1-801-581-3413, FAX: 1-801-581-4816)
Web page:
http://www.eng.utah.edu/~nairn
_______________________________________________
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.