Micro Focus QTP (UFT) Forums
How to avoid system lock while running Windows Based Application - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: How to avoid system lock while running Windows Based Application (/Thread-How-to-avoid-system-lock-while-running-Windows-Based-Application)



How to avoid system lock while running Windows Based Application - SaranKumarV - 12-13-2010

HI All,

We have an Windows based application which we are planning to run on nightly builds, Problem is when we run the script the system gets locked for every 10 min . Is there any workaround to keep system unlocked when running windows based applications.

Regards,
SaranKumarV


RE: How to avoid system lock while running Windows Based Application - manishbhalshankar - 12-13-2010

Hi Saran,

Turn off the password protected screensaver if it is on and also check if there is any setting to lock the computer automatically if left idle.


RE: How to avoid system lock while running Windows Based Application - bfakruddin - 12-13-2010

Hi Saran,

We can handle this... not an issue.

If you're able to download "Caffeine 1.4"... It's a small software(in KB's) available on website, you can run this on system to disable the automatic locking on your system. It is freeware so you can download in your company and use, not a problem.

still if your company strictly blocks such type of softwares.

you can handle through scripting...

Develop one VBScript file to run in background.
I'm not giving exact code here, just logic
Logic is :
1.send expectation time to keep your system desktop active.
2.take present time and sent time (eg: in hrs),
3.compare both of them and enter into loop
4.make wscript to sleep for some time like (less than automatic lock time)
5.press any lockkey (numkey, scrollkey) twice

it repeats step 3... till the sent hrs completed.

once it reaches the time, it will not enter into loop to sleep and press lockkeys.

It might locks after some time.

If you're not satisfy let me know.


RE: How to avoid system lock while running Windows Based Application - sudha_abap - 12-23-2010

Hi Saran,

Code:
Create .vbs file with the follwing code:
    Const DELAY_MINUTES = 10

    Wscript.Sleep DELAY_MINUTES * 60000
    Do
      CreateObject("Wscript.Shell").SendKeys "+"
      Wscript.Sleep DELAY_MINUTES * 60000
    Loop
Then using this .vbs create a task in the task scheduler.

Regards,
Sudha


RE: How to avoid system lock while running Windows Based Application - Munna.Sarfraz - 01-17-2012

Create a VBS file, Copy below code and paste it.

Code:
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


Save it, and double click on it, it will work


RE: How to avoid system lock while running Windows Based Application - Munna.Sarfraz - 01-18-2012

Just Down load the Attached Zip file Extract it,
Execute the extracted VBS file into your system (VBS Execution: Double click on the VBS icon)

It will avoiding you system lock issues.

Regards,
Munna Sarfraz


RE: How to avoid system lock while running Windows Based Application - blr.moin@gmail.com - 03-21-2018

(12-13-2010, 10:31 AM)SaranKumarV Wrote: HI All,

 We have an Windows based application which we are planning to run on nightly builds, Problem is when we run the script the system gets locked for every 10 min . Is there any workaround to keep system unlocked when running windows based applications.

Regards,
SaranKumarV

Hi SaranKumar,

Please follow the below instructions:
  • Create a simple vbs file having code to press numlock key and run that vbs file

  • Edit one registry key “DisableLockWorkstation =1” to disable locking
    Regards,Moin