• 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: 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]

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


  • Subject: Re: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 15 May 2016 10:08:38 +0200


Le 14 mai 2016 à 16:18, Christopher Stone <email@hidden> a écrit :

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"}


I'm puzzled.

I ran your Smile Beta Version Checker and it said that I was up to date.
When I ran the code above I got --> {"3.8.0", "959"}


So I entered http://satimage.fr/software/fr/downloads/index.html

I read : Smile 3.8.0 (build 959) version complète

As I am curious I continued.

I downloaded and  got : Smile956.pkg

After installing running every proposed codes I get : --> {"3.8.0", "960"}

Isn't it a bit odd ?


Yvan KOENIG running El Capitan 10.11.4 in French (VALLAURIS, France) dimanche 15 mai 2016 10:03:17





 _______________________________________________
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: Christopher Stone <email@hidden>
References: 
 >ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • Next by Date: Re: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • Previous by thread: Re: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • Next by thread: Re: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • Index(es):
    • Date
    • Thread