plist

Hello People…

Is there a way to read the info.plist inside a application like VLC, i need to get the current installed version for VLC…

Thanks

Hi,


get version of application "VLC"

Hi mkh,

The solution provided by StefanK is most elegant and prefered.

But just for the sake of completeness I am posting the AppleScript code that directly reads the info from the Info.plist file. This can be useful when you need additional information about an application like the file name of its application icon, etc.


set itunespath to POSIX path of (path to application "iTunes")
set infopath to itunespath & "Contents/Info"
set itunesversion to do shell script "defaults read" & space & quoted form of infopath & space & "CFBundleVersion"

oh my, sometimes the most simple solution is the one you cant see, thx alot u 2

Okay, so this is working great, but can it be done without ativating VLC ?

Okay, in my case, the following code does not activate iTunes:


set itunespath to "/Applications/iTunes.app"
set infopath to itunespath & "/Contents/Info"
set itunesversion to do shell script "defaults read" & space & quoted form of infopath & space & "CFBundleVersion"

But maybe one should check first, if iTunes is really installed on the Mac in question:


set itunespath to "/Applications/iTunes.app"
try
	set itunesalias to ((POSIX file itunespath) as Unicode text) as alias
on error
	return missing value
end try
set infopath to itunespath & "/Contents/Info"
set itunesversion to do shell script "defaults read" & space & quoted form of infopath & space & "CFBundleVersion"
return itunesversion

A different approach without launching VLC


try
	tell application "Finder" to set infopath to POSIX path of (application file id "org.videolan.vlc" as alias) & "Contents/Info"
	set VLCversion to "VLC version: " & (do shell script "defaults read " & quoted form of infopath & " CFBundleVersion")
on error
	set VLCversion to "VLC not installed"
end try
display dialog VLCversion

FYI, this issue doesn’t exist in AppleScript 2.0 (i.e., Leopard).

You are so right, but when working in AS and then build the application and run it from within AS the issue is there

if i build the app and place it on my desktop and then run it, the problem is gone :slight_smile: and that is what i need, i can live with the popup
of VLC when working on the project…

thx alot