There are few ways to prevent windows to lock the system:
Way1:
Download the software
Caffeine 1.4 and install on the machine where u run the scripts.
Way 2:
Create a .vbs file (with the below mentioned code) and a task in task scheduler
Const DELAY_MINUTES = 10
Wscript.Sleep DELAY_MINUTES * 60000
Do
CreateObject(“
Wscript.Shell”).SendKeys “+”
Wscript.Sleep DELAY_MINUTES * 60000
Loop
Way 3:
Create a .vbs file (with the below mentioned code) and a task in task scheduler
Const micVoid = 0
Const micByte = 26
Const micLong = 3
Const KEYEVENTF_KEYUP = &H2
Set Extern = CreateObject("Mercury.ExternObj")
extern.Declare micVoid, "keybd_event", "user32", "keybd_event", micByte, micbyte, miclong, micLong
Extern.Declare micVoid, "Sleep", "kernel32", "Sleep", micLong
While True
extern.keybd_event 0, 0, KEYEVENTF_KEYDOWN, 0
Extern.Sleep 20000
Wend
-********************-*****************-*****************************-*********************************-*****************************
We can even run the scripts when the system is locked, but QTP may not replay constantly on a locked machine
The Quick Test Professional computer is locked or logged off.
Quick Test Professional was launched without permission to interact with the desktop.
The following registry key which enables you to run tests on a remote computer, even on an incompatible execution environment:
HKEY_CURRENT_USERSoftwareMercury InteractiveQuick Test ProfessionalMicTestSkipEnvironmentChecks
Set the registry key to 1 to prevent the remote execution checks, and 0 to perform the checks.