• 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/Write Text Files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Read/Write Text Files


  • Subject: Re: Read/Write Text Files
  • From: Laine Lee <email@hidden>
  • Date: Thu, 01 Apr 2010 15:55:48 -0500
  • Thread-topic: Read/Write Text Files

Title: Re: Read/Write Text Files
"Open for access" no longer appears to be needed for Leopard and Snow Leopard.

set prefsFolder to (path to preferences folder from user domain)
set posixPath to (POSIX path of prefsFolder)
set prefsName to "com.plist_scripting_example_with_a_really_long_name_so_I_can_spot_it_in_list_view"
do shell script "defaults write " & posixPath & prefsName & " \"first item\" \"first item's value\""
set the plistfile_path to ((POSIX path of prefsFolder) & prefsName & ".plist")

tell application "System Events"
    
set this_plistfile to (get property list file plistfile_path)
    
if (get value of property list item "first item" of contents of this_plistfile) is not "revised item value" then
       set value of property list item "first item" of contents of this_plistfile to "revised item value"
    
end if
   make new property list item at end of property list items of contents of this_plistfile with properties {kind:string, name:"second item", value:"second item's value"}
end tell

Laine Lee

 _______________________________________________
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: Read/Write Text Files
      • From: Michelle Steiner <email@hidden>
    • Re: Read/Write Text Files
      • From: Laine Lee <email@hidden>
  • Prev by Date: Re: Property lists and System Events (was: no subject)
  • Next by Date: Re: Read/Write Text Files
  • Previous by thread: Attempting to intervene in the "Close" process
  • Next by thread: Re: Read/Write Text Files
  • Index(es):
    • Date
    • Thread