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

Re: New plist File


  • Subject: Re: New plist File
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 02 Feb 2011 14:59:47 -0600

On Feb 2, 2011, at 2:29 PM, Stan Cleveland wrote:

How about this? One property of a 
property list file
 is 
path
, which is an alias.

on makeNewPlistFile(folderAlias, filename, initialRecord)
set newFileName to (folderAlias as text) & filename & ".plist"
tell application "System Events"
make new property list item with properties {kind:record, value:initialRecord}
set pFile to 
make new property list file with properties {contents:the result, name:newFileName}
return 
path 
of 
pFile
end tell
end makeNewPlistFile --------------------------------------------------------------------

You're right. Thanks! Here's the updated handler ...

on makeNewPlistFile(folderAlias, filename, initialRecord)
set newFileName to (folderAlias as text) & filename
tell application "System Events"
make new property list item with properties {kind:record, value:initialRecord}
make new property list file with properties {contents:the result, name:newFileName}
set newFileName to (path of the result)
end tell
tell application "Finder" to update folder folderAlias -- This may not be necessary.
return (newFileName as alias)
end makeNewPlistFile --------------------------------------------------------------------
-- folderAlias is an alias to the location where the new file is created
-- filename is text, the name of the new file without ".plist"
-- initialRecord is an AppleScript record which becomes the content of the new file

I put the 'update folder ...' in as a possible fix for another problem not related to plist files.

 _______________________________________________
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: 
 >New plist File (From: Luther Fuller <email@hidden>)
 >Re: New plist File (From: Stan Cleveland <email@hidden>)

  • Prev by Date: Re: New plist File
  • Next by Date: Re: New plist File
  • Previous by thread: Re: New plist File
  • Next by thread: Re: New plist File
  • Index(es):
    • Date
    • Thread