home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
-
- /**
- @Tool: autoSave~saves all existing documents at a specified interval.
- The initial interval is set to 2 minutes. To change the interval run
- this script. To turn auto save on or off use the preferences dialog.
- @EndTool:
- @Summary: autoSave~saves all existing documents at a specified interval
- */
-
- /////////////////////////////////////////////////////////////////////////
- // WARNING: Do not edit this script when autosave is active
- // To edit, first turn autosave off using the preference dialog,
- // then restart and edit this script. Next turn autosave on and restart.
- /////////////////////////////////////////////////////////////////////////
-
- var gOutput = getOutput();
- var gDuration = 120; // Seconds
- var gAutoSave = true;
- var gBackupFolder = File.getLibraryPath() + "\\Backup\\";
-
- function DoCommand()
- {
- var value = prompt("Set auto save interval (seconds)", "" + gDuration);
- if (value)
- {
- gDuration = parseInt(value);
- var workspaceData = getMapFile("Workspace", true);
- workspaceData.setValue("Autosave Interval", gDuration);
- }
- }
-
- function OnStartupTask()
- {
- gAutoSave = getMapFileValue("Preferences", "Auto save files", true);
- if (gAutoSave)
- {
- var logEvents = getGlobal("LogEvents", false);
- if (logEvents)
- {
- gOutput.writeLine("Starting Autosave Task");
- }
-
- gDuration = getMapFileValue("Workspace", "Autosave Interval", gDuration);
- Application.schedule("DoTask", gDuration, null, getScriptPath());
- }
- }
-
- function DoTask()
- {
- gAutoSave = getMapFileValue("Preferences", "Auto save files", true);
- if (gAutoSave)
- {
-
- Application.autoSave();
-
- //Schedule again
- Application.schedule("DoTask", gDuration, null, getScriptPath());
- }
- }
-
- !!/Script
-
-