• 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: List all the app-defined keywords?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: List all the app-defined keywords?


  • Subject: Re: List all the app-defined keywords?
  • From: Christopher Nebel <email@hidden>
  • Date: Sat, 1 Aug 2009 12:07:17 -0700

On Aug 1, 2009, at 2:05 AM, Emmanuel LEVY wrote:

On Jul 31, 2009, at 10:38 PM, David Springer wrote:

tell application "Some App"
   set keylist to keywords of application
   return keylist
end tell

Is there a way to do this? How?

I think that most of the scriptable apps contain their AppleScript dictionary as an XML file in theapp.app/Contents/Resources/.


I found such a file in Smile: Smile.sdef.
I found two such files in Mail: Mail.scriptSuite and Mail.scriptTerminology.


Maybe someone more knowledgeable can tell more precisely.

Any scriptable application has its dictionary embedded in the application, but there are three different formats it could be in. However, there's a tool that will extract any of them as an sdef (the most modern format; man 5 sdef for details), so if you don't mind a bit of command-line magic:


% sdef /Applications/Mail.app | perl -ne 'print "$_\n" foreach / name="([^"]+)"/g' | sort -dfu

The sdef(1) bit gets the application scripting interface as an sdef, the perl(1) bit pulls out all the "name" attributes, which is where all the scriptable terms are (plus a bit of other extraneous stuff such as suite names; this isn't perfect), and finally the sort(1) bit puts them all in alphabetical order.


--Chris Nebel AppleScript Engineering _______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Re: List all the app-defined keywords? (From: Emmanuel LEVY <email@hidden>)

  • Prev by Date: Auto: AppleScript-Users Digest, Vol 6, Issue 349
  • Next by Date: Wait for Load with PDF download in Safari
  • Previous by thread: Re: List all the app-defined keywords?
  • Next by thread: Re: Auto: AppleScript-Users Digest, Vol 6, Issue 348
  • Index(es):
    • Date
    • Thread