Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

An AppleScript to easily backup Uplink save game files Apps
When playing Uplink, it's often helpful to back up one's agent files, since getting caught is irreversible and essentially makes one start over from scratch. If one has backed up one's agent files, however, one has a chance to go back and correct one's mistakes.

I've created an Applescript to automate the backing up, and archiving, of Uplink agent files. One will need to create a directory into which the agent file backups will go (mine is ~/Documents/Agent Backups). Here is the script:
set right_now to do shell script "date | awk '{print $1,$2,$3,$6,$4}'"
do shell script ¬
  "cd ~/Documents/\"Agent Backups\"/ ; tar cvf \"" & ¬
   right_now & ".tar\" *.usr ; gzip \"" & right_now & ".tar\""
-- the next three lines are one long line, but you'll have
-- to manually combine the last two segments, as you can't  
-- put an AppleScript line break in a shell command!
do shell script ¬
   "cp \"/Applications/Games/Uplink 1.0.0/Users/\"*.usr 
    ~/Documents/\"Agent Backups\"/"
launch application "TextEdit"
The script should be entered into Script Editor as four lines, and saved as an application. One will also probably want to put it into one's dock, so that the agent files can be backed up and archived and Uplink can be launched with only one click. Before using the script, one will want to change the backup paths in the "do shell script" commands to match whatever backup architecture one has created. The script does the following:
  1. Archives any currently un-archived backed up agent (.usr) files into a tarball using the current date and time as the filename (this is handy if one needs to revert to an even older version of an agent file).
  2. Backs up one's current agent files.
  3. Starts Uplink.
Be sure to, every so often, delete any unwanted backup archives, since, although the archives are compressed, they still take up some space. Alternately, lines one and two of the Applescript can be commented out to disable backup archiving.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[12,037 views]  

An AppleScript to easily backup Uplink save game files | 4 comments | Create New Account
Click here to return to the 'An AppleScript to easily backup Uplink save game files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to easily backup Uplink save game files
Authored by: athagon on Jun 04, '03 01:57:42PM

Uh... when I submitted the hint, the last line was "launch application 'Uplink'" not "launch application 'TextEdit'"

---
"That which does not kill me makes me stronger." - Friedrich Nietzsche



[ Reply to This | # ]
An AppleScript to easily backup Uplink save game files
Authored by: peterneillewis on Jun 04, '03 10:14:10PM

You do not need to combine date with awk, date has its own formatting ability (man date for info). For example, I typically use this:

/bin/date '+%Y-%m-%d %H:%M:%S'

which produces a date like "2003-06-05 10:09:26" which then sorts correctly in the Finder (or anywhere) so that you can sort by name and always see the correct date order of your entries.



[ Reply to This | # ]
An AppleScript to easily backup Uplink save game files
Authored by: UltraNurd on Jun 05, '03 12:24:11AM

I just bought and got addicted to the game, and although I miss the infinite continues of Escape Velocity, I think that the risk of an unusable game makes it that much more of a challenge. I am tempted to use your backup method, but for now, I will continue to test my l33t sK1lLz ;o).



[ Reply to This | # ]
An AppleScript to easily backup Uplink save game files
Authored by: UltraNurd on Jul 06, '03 10:25:00PM

You can combine tarring and gzipping into one step; just specify 'z' as one of the command-line options to tar, as in "tar czvf". You should probably make the suffix of the output file .tar.gz or .tgz, so StuffIt and other GUI apps know what's up. This shortens the second line of your script.



[ Reply to This | # ]