home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
-
- /**
- @Tool: autoBackup~backup all modified documents to Library/Backup at
- the specified interval. The initial interval is set to 2 minutes.
- To change the interval run this script. To turn auto backup on or off use
- the preferences dialog.
- @EndTool:
- @Summary: autoBackup~backup all modified documents
- */
-
- var gOutput = getOutput();
- var gDuration = 120; // Seconds
- var gAutoBackup = true;
- var gBackupFolder = File.getLibraryPath() + "\\Backup\\";
-
- function DoCommand()
- {
- var value = prompt("Set auto backup interval (seconds)", "" + gDuration);
- if (value)
- {
- gDuration = parseInt(value);
- var workspaceData = getMapFile("Workspace", true);
- workspaceData.setValue("Autobackup Interval", gDuration);
- }
- }
-
- function OnStartupTask()
- {
- var preferencesData = getMapFile("Preferences", true);
- gAutoBackup = preferencesData.lookup("Auto backup files", true);
-
- if (gAutoBackup)
- {
- var logEvents = getGlobal("LogEvents", false);
- if (logEvents)
- {
- gOutput.writeLine("Starting Autobackup Task");
- }
-
- gDuration = getMapFileValue("Workspace", "Autobackup Interval", gDuration);
-
- preferencesData.setValue("Auto backup files", gAutoBackup);
-
- Application.schedule("DoTask", gDuration, null, getScriptPath());
- }
- }
-
- function DoTask()
- {
- gAutoBackup = getMapFileValue("Preferences", "Auto backup files", true);
- if (gAutoBackup)
- {
-
- Application.backupAll(gBackupFolder);
-
- //Schedule again
- Application.schedule("DoTask", gDuration, null, getScriptPath());
- }
- }
-
- !!/Script
-
-