Job Template (for running database maintenance script etc)

Handy script with some failsafe stuff built into it.

I woulnd'nt give users access to it, you still need to know what you are doing.

static void _TestJobTemplate(Args _args) {   Dialog      dialog          = new Dialog("Heading of the dialog."); Dialog     dlgAreYouSure   = new Dialog("Are you sure?"); DialogField                dfAreYouSure; DialogField                dfDryRun; str                        sDryRun     = "Dry Run(not modf. data)?"; str                        sAreYouSure = "Are you sure?"; str                        sUserAbort  = "User aborted operation.";

// Setting vars boolean                    UseTTS = NoYes::No; // Use tts on (live operation)

;   dfDryRun = dialog.addField(typeId(NoYes),sDryRun);

if (dialog.run) {       // Fetch values from optional dialog fields /*       // Check that those values has been submitted if(!VAR) throw error("You need to supply XY"); */       if(dfDryRun.value) {           // Dry Run logic goes here.

} else {

dfAreYouSure = dlgAreYouSure.addField(typeId(NoYes),sAreYouSure);

if(dlgAreYouSure.run) {           if(dfAreYouSure.value) {               if(UseTTS) ttsbegin; // Live run logic goes here

if(UseTTS) ttscommit; } else throw error(sUserAbort); } else throw error(sUserAbort); }   } }