• 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: AppleScript Dictionary in AppleScript Studio
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript Dictionary in AppleScript Studio


  • Subject: Re: AppleScript Dictionary in AppleScript Studio
  • From: Philip Aker <email@hidden>
  • Date: Mon, 18 May 2009 08:18:17 -0700

On 2009-05-17, at 21:09:54, Paul Scott wrote:

I don't understand what you are talking about. Can you be more explicit?

When I'm writing code in AppleScript Studio, can I access application dictionaries directly? Or do I have to go through Script Editor? Please, no third-party solutions.


You can do this with OSACopyScriptingDefinition(). It's an easy XML parse and there are other helpful APIs in ASDebugging.h.

1. Get an FSRef of the application owning the dictionary in question.
2. Copy the contents of the dictionary to a CFDataRef with OSACopyScriptingDefinition().
3. Load an XML facility with the sdef contents [1] by using CFDataGetBytePtr() and CFDataGetLength() [2].
4. Parse the loaded XML to obtain the desired information.


Since you are working in AppleScript Studio, if you wish to have a dictionary viewer, you should be able to utilize an OSADictionaryView from the Open Scripting Kit in Interface Builder's Library panel. This will require some Cocoa code.

ยง

[1] Some XML utilities require you to load from an explicit path -- which you can deduce from the OSAScriptingDefinition key in the application's Info.plist.

[2] On 10.5 the built-in XML facilities include CFXMLParser/CFXMLNode, NSXMLDocument (et. al.), libxml2/libxslt, and libexpat.

Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.

_______________________________________________
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: 
 >AppleScript Dictionary in AppleScript Studio (From: Paul Scott <email@hidden>)
 >Re: AppleScript Dictionary in AppleScript Studio (From: Philip Aker <email@hidden>)
 >Re: AppleScript Dictionary in AppleScript Studio (From: Paul Scott <email@hidden>)

  • Prev by Date: Re: Debug AppleScript Droplet in AppleScript Studio
  • Next by Date: Re: Display Dialog with Title
  • Previous by thread: Re: AppleScript Dictionary in AppleScript Studio
  • Next by thread: Re: AppleScript Dictionary in AppleScript Studio
  • Index(es):
    • Date
    • Thread