View Full Version : Save System in AppleScript
Feb 25, 2013, 06:03 AM
Currently working on a text based AppleScript game but how would I go about making a save system?:confused:
Feb 25, 2013, 01:17 PM
If this is a regular AppleScript application you can store data in properties or use a preferences .plist file via defaults (http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/defaults.1.html) or the Property List Suite from System Events. For an Xcode or Cocoa-AppleScript application there is NSUserDefaults (https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html).
Feb 25, 2013, 04:59 PM
Have a look at NSSavePanel.
Feb 25, 2013, 06:58 PM
Thanks for the help I appreciate it.
Feb 25, 2013, 07:01 PM
Currently working on a text based AppleScript game
That's about the insanest thing I've heard all week. Granted, it's only Monday, but still. :rolleyes:
Feb 26, 2013, 03:30 AM
Ya it's pretty easy/hard at times due to it being pseudocode and it's just plain vanilla AppleScript however using .plist files how would I save/load variables
Feb 26, 2013, 09:34 AM
Ah, I thought you want to save a file such a text file.
You have to say "do shell script" and then something like that: defaults write com.apple.Finder AppleShowAllFiles NO
Instead of NO you can use your variable and instead of com.apple.Finder you use the name of your .plist file.
The .plist file has to be in the following directory: ~/Library/Preferences/.
I hope this helps!