From 7bf6f00810362cedca5ea5c1f4d9fcf84584a254 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 3 Oct 2010 19:33:08 +0200 Subject: [PATCH] Added SaveOnRun option to CRov (onScriptStart and onScriptCompile). --- Extensions/CRov.sex | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Extensions/CRov.sex b/Extensions/CRov.sex index 8af4ff6..f53a339 100644 --- a/Extensions/CRov.sex +++ b/Extensions/CRov.sex @@ -4,11 +4,12 @@ program CRov; const Version = '0.6'; - SettingsMenuDef = 'False'; //True if you want to be able to set the saving interval through the menu (otherwise it's accessible through plugin settings) - ForceSaveDef = 'True'; //Force user to save the script, instead of opening it - DirDef = 'CRov\'; //Appended to AppPath + SettingsMenuDef = 'False'; //True if you want to be able to set the saving interval through the menu (otherwise it's accessible through plugin settings) + ForceSaveDef = 'True'; //Force user to save the script, instead of opening it + SaveOnRunDef = 'True'; //Make backup when user compiles/runs the script + DirDef = 'CRov\'; //Appended to AppPath ExtensionDef = 'crov'; - DefInterval = '300000'; //every 5 minutes + DefInterval = '300000'; //every 5 minutes type TCharArray = array of Char; @@ -23,7 +24,7 @@ var Tab: Integer; FileNames: TStringList; - SettingsMenu, ForceSave: Boolean; + SettingsMenu, ForceSave, SaveOnRun: Boolean; Dir, Extension: string; function StringToCharArray(s: string): TCharArray; @@ -279,6 +280,20 @@ begin end; end; +procedure onScriptStart(var Script: string; var Cont: Boolean); +begin + if SaveOnRun then + OnTimer(Timer); + Cont := True; +end; + +procedure onScriptCompile(var Cont: Boolean); +begin + if SaveOnRun then + OnTimer(Timer); + Cont := True; +end; + procedure Init; var i: Integer; @@ -288,6 +303,7 @@ var begin SettingsMenu := LowerCase(Settings.GetKeyValueDef('SettingsInMenu', SettingsMenuDef)) = 'true'; ForceSave := LowerCase(Settings.GetKeyValueDef('ForceSave', ForceSaveDef)) = 'true'; + SaveOnRun := LowerCase(Settings.GetKeyValueDef('SaveOnRun', SaveOnRunDef)) = 'true'; Dir := Settings.GetKeyValueDef('Directory', AppPath+DirDef); Extension := Settings.GetKeyValueDef('Extension', ExtensionDef);