• 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
ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example


  • Subject: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 14 May 2016 09:18:06 -0500

Hey Folks,

Building a bit on my Smile Version Checker.

This shows how to use ASObjC instead of `mdfind` to find an app via its Bundle-ID.

Smile is the app I'm looking for.

Then I grab the CFBundleVersion and CFBundleShortVersionString values directly from Smile's info.plist file using Satimage's XMLLib.osax.

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2016/05/02 03:54
# dMod: 2016/05/14 08:53
# Appl: AppleScriptObjC + XMLLib.osax
# Task: Get Path to Application Bundle ID using ASObjC.
# Aojc: True
# Libs: None
# Osax: XMLLib.osax { http://tinyurl.com/dc3soh }
# Tags: @Applescript, @Script, @System_Events, @XMLLib.osax, @Read, @Keys, @Plist
-------------------------------------------------------------------------------------------
use framework "Foundation"
use scripting additions
-------------------------------------------------------------------------------------------

set bundleID to "com.satimage.Smile"
set theURL to current application's NSWorkspace's sharedWorkspace()'s URLForApplicationWithBundleIdentifier:bundleID
set appFilePathHFS to theURL as text
set infoPlistFile to alias (appFilePathHFS & "Contents:Info.plist")

-------------------------------------------------------------------------------------------
# Getting keys from a Smile's info.plist file using the XMLLib.osax:
-------------------------------------------------------------------------------------------

set _plist to PlistOpen infoPlistFile
set smileVersion to PlistGet _plist key "CFBundleShortVersionString"
set smileBundleVersion to PlistGet _plist key "CFBundleVersion"
PlistClose _plist

{smileVersion, smileBundleVersion}

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

--> {"3.8.0", "960"}


 _______________________________________________
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: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
      • From: Yvan KOENIG <email@hidden>
    • Re: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Smile Beta Version Checker
  • Next by Date: Re: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • Previous by thread: Smile Beta Version Checker
  • Next by thread: Re: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • Index(es):
    • Date
    • Thread