• 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: read a plist
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read a plist


  • Subject: Re: read a plist
  • From: Luther Fuller <email@hidden>
  • Date: Tue, 15 Jan 2008 14:31:51 -0600

This code has been working for years ...

tell application "System Events" -- read from Info.plist file in bundleRef = source bundle
(item "Info.plist" of folder "Contents" of bundleRef) as alias
set InfoRecord to (value of property list file (POSIX path of the result))
end tell
tell application "System Events" -- read ScriptBundleToolUserItems in project.plist file
(item "project.plist" of contentsSource) as alias
POSIX path of the result
value of property list item "ScriptBundleToolUserItems" of property list file the result
end tell
set InfoRecord to the result & InfoRecord
tell application "System Events" -- write to Info.plist file in bundleRef = source bundle
(item "Info.plist" of folder "Contents" of bundleRef) as alias
set (value of property list file (POSIX path of the result)) to InfoRecord
end tell


On Jan 15, 2008, at 2:07 PM, KOENIG Yvan wrote:

Hello

I have an HFS path to a plist file :
set thePlist to "Macintosh HD:Users:yvankoenig:Library:Preferences:com.apple.iWork.Numbers.plist"


How may I use it to read a value in the plist file?

I tried:

set thePlist to "Macintosh HD:Users:yvankoenig:Library:Preferences:com.apple.iWork.Numbers.plist"
set thePlist to POSIX file thePlist
tell application "System Events"
tell contents of property list file thePlist
{value of property list item "LSDocumentDefaultSaveDirectory"}
end tell
end tell


but it fails.

I checked that if I define


set thePlist to "~/Library/Preferences/com.apple.iWork.Numbers.plist"

It works but how may I convert flawlessly the original path to a usable one ?

Yvan KOENIG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden

_______________________________________________ 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
References: 
 >read a plist (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: read a plist
  • Next by Date: How to convert Photoshop Javascript to applescript?
  • Previous by thread: read a plist
  • Next by thread: Re: read a plist
  • Index(es):
    • Date
    • Thread