The correct solution for you is
function disableSleep()
{
var ES_SYSTEM_REQUIRED = 0x00000001;
var ES_DISPLAY_REQUIRED = 0x00000002;
var kernel = DLL.DefineDLL("kernel32");
var lib = DLL.Load("c:\\Windows\\System32\\kernel32.dll");
var proc = kernel.DefineProc("SetThreadExecutionState", vt_i2, vt_void);
lib.SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
}
But since it only sends command to OS, but not sets some kind of settings, you need to run it from time to time. For instanse, you can create Timer and call this function every minute.