On Sat, Oct 18, 2008 at 4:05 PM, Pierce Freeman <[EMAIL PROTECTED]> wrote: > I am attempting to create a little application that will take an application > name from the user, and then close it for them. I am attempting do this by > getting the string in Cocoa, then passing this to AppleScript... But I don't > know if Cocoa can pass variables to AppleScript. I imagine that there must > be some way, as this would be very useful, but if so there is not a lot of > documentation for it (at least using the phrases that I'm using).
Expect has to jump in here at any moment touting the virtues of AppScript. <g> What you're actually looking to do is send a Quit Apple Event to the user's selected application. This is what the Quit item on an application's Dock tile does, as does hitting Cmd-Q on the Cmd-Tab switcher. AppleScript is a human-readable syntax for creating Apple Event descriptors. Apple Events is an IPC protocol, and AppleScript allows end-users to take advantage of it. So forget about AppleScript for now. As far as Apple Events is concerned, to send one to another app, you construct an Apple Event descriptor. If you want to go the standard route, you can find the documentation here: http://developer.apple.com/documentation/AppleScript/Conceptual/AppleEvents/intro_aepg/chapter_1_section_1.html Mike Ash has kindly built a nice library called AEVTBuilder that makes constructing Apple Events far more intuitive. You can find more info about it here: http://www.cocoadev.com/index.pl?AEVTBuilder Good luck! --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]