• 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
Satimage XMLLib.osax
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Satimage XMLLib.osax


  • Subject: Satimage XMLLib.osax
  • From: Christopher Stone <email@hidden>
  • Date: Fri, 03 May 2013 23:56:30 -0500

Hey Folks,

Periodically I've asked for a couple of simple usage examples of the Satimage XMLLib.osax, because every time I look at the dictionary my head hurts.

Unfortunately I don't find many useful examples anywhere, and the tutorials on the Satimage site are broken.

Today I needed to yank some info out of an application's Info.plist and thought I'd give it another try — I was pleasantly surprised to get something simple working without too much effort.

Select an application in the Finder and run the script to display three specific keys from its Info.plist file, and a listing of key-names and key-values.

I dislike using System Events to parse Plists (or for any other job), because it can take up to 3 seconds on my machine to launch (and occasionally longer) - which is utterly ridiculous for a little 800K application on an i7 MacBook Pro.

I want to learn how to use the XMLLib.osax to parse html as well, and I'd be glad to have some simple examples if someone has any.

Also: this link is dead.  If anyone has this script I'd love to have a copy.

-------------------------------------------------------------------------------------------

"If working samples help you, then you can get the source code for a script that also uses the Satimage XMLLib osax, with Safari's bookmark file. It does all the same kinds of tasks: reads the plist from disk, does some manipulating, writes the plist back to file."

The working script, a read me and the source code are all here:

http://orgdork.org/safari/AddSafariBookmark.html

-------------------------------------------------------------------------------------------


Best Regards,
Chris


-------------------------------------------------------------------------------------------


set appFlag to false

tell application "Finder"
  set _file to selection as alias list
  if _file ≠ {} then
    set _file to first item of _file
    if _file's kind contains "application" then
      set appFlag to true
    end if
  end if
end tell

set _plist to (_file as text) & "Contents:Info.plist"

if appFlag then
  try
    set _plist to alias _plist
  on error
    error "No Info.plist File Exists!"
  end try

  

  set plist_Doc to PlistOpen _plist

  

  set _name to PlistGet plist_Doc key "CFBundleName"
  set _version to PlistGet plist_Doc key "CFBundleShortVersionString"
  set _build to PlistGet plist_Doc key "CFBundleVersion"

  

  set var_Key_Names to PlistGetKeys plist_Doc
  set var_Key_Values to PlistGet plist_Doc key var_Key_Names

  

  PlistClose plist_Doc

  

end if

{¬
  {_name, _version, _build}, ¬
  var_Key_Names, ¬
  var_Key_Values ¬
    }

-------------------------------------------------------------------------------------------

 _______________________________________________
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

  • Follow-Ups:
    • Re: Satimage XMLLib.osax
      • From: Shane Stanley <email@hidden>
    • Re: Satimage XMLLib.osax
      • From: Alex Zavatone <email@hidden>
  • Prev by Date: Re: uneditable [OT]
  • Next by Date: Of interest to FastScripts users
  • Previous by thread: Problems with Sound Studio 3
  • Next by thread: Re: Satimage XMLLib.osax
  • Index(es):
    • Date
    • Thread