• 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: Creating a plist file in Applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a plist file in Applescript


  • Subject: Re: Creating a plist file in Applescript
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 01 Oct 2013 23:52:14 +1000

On 01/10/2013, at 11:17 PM, Jim Brandt <email@hidden> wrote:

So, my question is, is there a way to initialize, from Applescript, a plist file that is an array of arrays with no key?

Yes (by definition, an array has no key). You don't need anything more than System Events, and rather odd use of the name property:

set theList to {{"a", "b", "c"}, {"d", "e", "f"}}
set thePath to POSIX path of ((path to desktop as text) & "Test.plist")
tell application "System Events"
set theArray to make new property list item with properties {kind:list, value:theList}
set theFile to (make new property list file with properties {contents:theArray, name:thePath})
end tell

-->

<?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">
<array>
<array>
<string>a</string>
<string>b</string>
<string>c</string>
</array>
<array>
<string>d</string>
<string>e</string>
<string>f</string>
</array>
</array>
</plist>


-- 
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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: 
 >Creating a plist file in Applescript (From: Jim Brandt <email@hidden>)

  • Prev by Date: Creating a plist file in Applescript
  • Next by Date: Re: Creating a plist file in Applescript
  • Previous by thread: Creating a plist file in Applescript
  • Next by thread: Re: Creating a plist file in Applescript
  • Index(es):
    • Date
    • Thread