• 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: Plist entry
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plist entry


  • Subject: Re: Plist entry
  • From: Michael Ghilissen <email@hidden>
  • Date: Sun, 20 Jan 2008 23:04:15 -0500

Special thanks to Axel and Luther for their help.

This script works in Panther:

-- Cleans the Cookies.plist (Safari) by removing the unwanted cookies. Warning: crawls a bit!
set GoodCookies to {"nytimes.com", "apple.com"}
tell application "System Events"
set PLContents to contents of property list file "~/Library/Cookies/Cookies.plist"
set PLValue to value of PLContents
set NewPLValue to {}


repeat with R in PLValue
repeat with k in GoodCookies
ignoring case
if |Domain| of R ends with k then set end of NewPLValue to contents of R
end ignoring
end repeat
end repeat


set NewPL to make new property list item with properties {value:NewPLValue}
make new property list file with properties {name:"~/Desktop/Cookies.plist", contents:NewPL}
end tell

Now, am I correctly getting the gist of this plist in System Events by saying (compiled from your comments):

The Cookies.plist is constructed as:  [<array>...</array>] = list and  [<dict>...</dict>)] = record.

Script's structure:

Read contents of property list file / format
Read value of property list item ('root' dictionary/record)
Work on individual <dict>...</dict> entries / unit of data / record
Write value of property list item ('root' dictionary/record)
Write contents of property list file / format

When you read/write 'value' of the plist file, you are dealing with the 'root' dictionary/record.

Thanks much,

Michael












 _______________________________________________
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: Plist entry - Oops!
      • From: Michael Ghilissen <email@hidden>
References: 
 >Re: Plist entry (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Get only the name of the file, instead of the whole path!
  • Next by Date: Re: Plist entry - Oops!
  • Previous by thread: Re: Plist entry
  • Next by thread: Re: Plist entry - Oops!
  • Index(es):
    • Date
    • Thread