Save System in AppleScript

Discussion in 'Mac Programming' started by NecroDayz, Feb 25, 2013.

  1. macrumors newbie

    Joined:
    Feb 25, 2013
    #1
    Currently working on a text based AppleScript game but how would I go about making a save system?:confused:
     
  2. macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #2
    If this is a regular AppleScript application you can store data in properties or use a preferences .plist file via defaults or the Property List Suite from System Events. For an Xcode or Cocoa-AppleScript application there is NSUserDefaults.
     
  3. macrumors member

    Gugulino

    Joined:
    Dec 16, 2008
    Location:
    Switzerland
  4. thread starter macrumors newbie

    Joined:
    Feb 25, 2013
  5. ytk
    macrumors regular

    Joined:
    Jul 8, 2010
    #5
    That's about the insanest thing I've heard all week. Granted, it's only Monday, but still. :rolleyes:
     
  6. thread starter macrumors newbie

    Joined:
    Feb 25, 2013
    #6
    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
     
  7. Gugulino, Feb 26, 2013
    Last edited: Feb 26, 2013

    macrumors member

    Gugulino

    Joined:
    Dec 16, 2008
    Location:
    Switzerland
    #7
    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!
     

Share This Page