Applescript: read plist doesn't work
Hello,
In every application, there is a info.plist (in contents).
I want to read, from that plist, the value of the item "Icon File" (it's a string).
I tried this:
--selecting app
repeat
set appfile1 to (choose file with prompt "Choose an app to download the icon:")
set extention to get file type of (info for (appfile1))
if extention is "APPL" then
exit repeat
else
display dialog "Please select an app, not another file" with title "Error" buttons {"Ok"} default button "Ok"
end if
end repeat
--select plist
set appfile11 to do shell script "echo " & appfile1 & "Contents:info.plist"
--tell system events
tell application "System Events"
set p_list to property list file (appfile11)
value of property list item "Icon File" of p_list
end tell
(I tried with "of property list item "Information Property List"" and without it, because that item doesn't show up if I read the plist in 'Xcode', but it does in 'Plist Edit Pro')
Error:
error "System Events kreeg een fout: property list item \"Icon File\" of property list file \"Macintosh HD:Users:Isaiah:Downloads:UnRarX.app:Contents:Info.plist\" kan niet worden opgevraagd. " number -1728 from property list item "Icon File" of property list file "Macintosh HD:Users:Isaiah:Downloads:UnRarX.app:Contents:Info.plist"
Please help me,
Isaiah v. Hunen
Applescript-OTHER, Mac OS X (10.7.2)