Scriptable application startup behavior
Scriptable application startup behavior
- Subject: Scriptable application startup behavior
- From: Fabrizio La Rosa <email@hidden>
- Date: Sun, 25 Jan 2004 18:26:12 +0100
Hello,
I am trying to add AppleScript support to a document based Cocoa
application for the first time, hence maybe that the following question
could seem trivial to others.
The usual scripting support implementation problems should to be solved
(I hope) by the more exhaustive documentation about this argument
included in the latest Xcode Tools.
My problem is that the application could be launched by three kinds of
event, but I don't know how it can be aware of the latter of these
events:
- it is launched "as is", hence a "Untitled" document is created and
its window is showed (this is its default behavior because I actually
return YES in the applicationShouldOpenUntitledFile: NSApplication
delegate method).
- it is launched to open a saved document, hence that document's window
is showed
- it is launched by an AppleScript that tells it to perform some tasks,
starting from the data contained in a saved document.
In the latter case the application must open the document to parse its
data but no window controller has to be created, so that the associated
window is not showed.
I have seen that there is a NSApplication delegate method named
openFileWithoutUI: that could do the trick, but I don't know how and
when to handle it.
For your information, the application is built following the Cocoa
guidelines, so it has a NSWindowController subclass to manage all the
GUI outlets, actions and methods, a NSDocument subclass that acts as
the document controller and model object, a NSApplication delegate in a
separate subclass and a subclass of NSObject that is the "task
performer".
Thank you, Fabrizio
_______________________________________________
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.