• 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
Propeties don't persist from run to run in applet. What are my alternatives?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Propeties don't persist from run to run in applet. What are my alternatives?


  • Subject: Propeties don't persist from run to run in applet. What are my alternatives?
  • From: Luther Fuller <email@hidden>
  • Date: Sun, 18 Oct 2015 16:04:43 -0500

My application makes its own preference file, in the Preferences folder,
to store any properties or values that it uses.
Here's the handler I use ...

on makeNewPlistFile(folderAlias, filename, initialRecord)
try
return ((folderAlias as text) & filename & ".plist") as alias -- the file already exists
end try
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
return (newFileName as alias)
end makeNewPlistFile --------------------------------------------------------------------

I can read a value from this file, for example ...

tell application "System Events"
set mailAccountsList to (value of property list item "MailAccounts" of property list file (prefsPath as text))
end tell

and I can write a new value with ...

tell application "System Events"
set value of property list item "MailAccounts" of property list file (prefsPath as text) to mailAccountsList
end tell

I am currently using this with Mac OS 10.7.5 and I have another version that works with 10.8.

In which version of the Mac OX will this method no longer work ?



 _______________________________________________
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: Propeties don't persist from run to run in applet. What are my alternatives?
      • From: Shane Stanley <email@hidden>
References: 
 >Propeties don't persist from run to run in applet. What are my alternatives? (From: edmund ronald <email@hidden>)

  • Prev by Date: Re: AppleScript grammar
  • Next by Date: Re: Propeties don't persist from run to run in applet. What are my alternatives?
  • Previous by thread: Re: Propeties don't persist from run to run in applet. What are my alternatives?
  • Next by thread: Re: Propeties don't persist from run to run in applet. What are my alternatives?
  • Index(es):
    • Date
    • Thread