Help manipulating a plist file
Posted: Thu Jun 16, 2011 5:11 pm
Hi there,
Here is a section of the file:
So i have the file contents, and i currently have them displayed in a field, visible on the stack.
The file content is stored in a variable called: filecontent
I think i could explain that better in plain English.. Soory this is mixed with livecode, but i guess you guys that know, will know what is and what is not:
Any help with any stage of the above would be appreciated.
Here is a section of the file:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>2d955670-b357-4848-8a27-b0c8eaeaf367</key>
<dict>
<key>AccountURL</key>
<string>pop://sales%40doobox.co.uk@mail.doobox.co.uk/</string>
<key>Signatures</key>
<array>
<string>950E3D7D-234D-4DA7-9345-957635200E39</string>
<string>1dooboxsig</string>
</array>
</dict>
<key>AllSignaturesKey</key>
<array>
<dict>
<key>SignatureIsRich</key>
<false/>
<key>SignatureName</key>
<string>Signature #1</string>
<key>SignatureUniqueId</key>
The file content is stored in a variable called: filecontent
I think i could explain that better in plain English.. Soory this is mixed with livecode, but i guess you guys that know, will know what is and what is not:
Code: Select all
open file specialFolderPath("Home") & "/Library/Mail/Signatures/SignaturesByAccount.plist" for read
read from file specialFolderPath("Home") & "/Library/Mail/Signatures/SignaturesByAccount.plist" until EOF
local filecontent
put it into filecontent
search filecontent for all instances of an email address between the string values of
"<key>AccountURL</key>" and "<key>Signatures</key>"
put search result into theemailaddresses
put theemailaddresses into field emailaccounts // i am ok with this
upon clicking any of the addresses do this: // i am ok with this line
local mynewarray ="<array>
<string>950E3D7D-234D-4DA7-9345-957635200E39</string>
<string>newsigniture</string>
</array>"
put mynewarray into the file at the specific point
just before closing </dict> on the <dict> that the clicked email address resides in.