Re: Cocoa and AppleScript
Re: Cocoa and AppleScript
- Subject: Re: Cocoa and AppleScript
- From: has <email@hidden>
- Date: Mon, 26 May 2008 21:36:43 +0100
J. Todd Slack wrote:
Can anyone point me to an example (maybe a downloadable .zip) of an
XCode project that when the app it runs it runs an applescript, does
not display any windows or anything....maybe just displays "Hello
World" in a display dialog by using "on run"
I am somewhat confused as I tried creating a default AppleScript
application and adding "on run" to the applescript and it does not
work....
Note that AppleScript Studio questions should be directed to the
applescript-studio mailing list:
http://lists.apple.com/mailman/listinfo/applescript-studio
To answer your question:
Desktop Cocoa applications are event driven. Studio-based applications
consist of a Cocoa-based wrapper around one or more AppleScript script
objects. For the script to do anything, the wrapper has to send it an
event. To hook up the outer wrapper with the inner script, you use
Interface Builder.
For example, to send an event when the application has finished
launching, once you've created your AppleScript Studio project, open
MainMenu.nib and select the main 'Application' object. In the
Inspector palette, which is now showing the attributes for the
Application object, click on the tab with the AppleScript icon. In the
'Script' menu, select the name of the script you want it to send
events to, then in the 'Event Handlers' list select 'Application >
Launched'. Save MainMenu.nib, then go back to Xcode and open the
script - you'll find an empty 'on launched ...' handler has been added
to which you can add the code that you want executed when the
application has finished launching.
HTH
has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden