• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Passing Variables to AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing Variables to AppleScript


  • Subject: Re: Passing Variables to AppleScript
  • From: "Kyle Sluder" <email@hidden>
  • Date: Sat, 18 Oct 2008 19:59:33 -0400

On Sat, Oct 18, 2008 at 4:05 PM, Pierce Freeman
<email@hidden> 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 (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

References: 
 >Passing Variables to AppleScript (From: Pierce Freeman <email@hidden>)

  • Prev by Date: Re: Designing reports in Cocoa apps
  • Next by Date: Re: WIndow from external framework not working
  • Previous by thread: Passing Variables to AppleScript
  • Next by thread: Re: Passing Variables to AppleScript
  • Index(es):
    • Date
    • Thread