Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to make windows stop to sleep using VBscript
set wsc = CreateObject("WScript.Shell")
Do
'Five minutes
WScript.Sleep(5*60*1000)
wsc.SendKeys("{NUMLOCK}")
Loop
@sriramkannan95
Copy link

sriramkannan95 commented Mar 18, 2019

Good one. But toggling the Numlock every five minutes might annoy some people. I suggest using this instead:
wsc.SendKeys("{F13}")
F13 functionality is still not implemented in Windows. It is left for future use. But it is a valid key. So using this won't affect any other operations

@GeorgiKarapetrov
Copy link

GeorgiKarapetrov commented Aug 14, 2020

Or you can send NUMLOCK twice in each iteration. Thanks for this.

@aboee
Copy link

aboee commented Nov 5, 2020

Hi,

I run it but i need to stop it ? please guide me

@GeorgiKarapetrov
Copy link

GeorgiKarapetrov commented Nov 10, 2020

You could run it in cmd and close cmd when you want to stop it.

@valdergallo
Copy link
Author

valdergallo commented Nov 10, 2020

You could use task manager to kill the command

@sumitbsn
Copy link

sumitbsn commented Jan 25, 2021

You can run it from cmd and then use ctrl+c in case if you want to stop.
cmd:> cscript scriptname.vbs

@tdas777
Copy link

tdas777 commented Apr 20, 2021

Hi,
It's working. But i want to add a condition, if on AC power then send keys.
Please guide.

@mdnoor123
Copy link

mdnoor123 commented Jul 16, 2021

Above code is not working for me. Sapience buddy(time tracking tool) unable to track this timing. Pkease help me

@mdnoor123
Copy link

mdnoor123 commented Jul 16, 2021

"Hi All,

Can you please tell me how to get rid of sapience buddy (time tracking tool). Am unable to convert offline hours to work time hours since its disabled by admin.

Even if i am browsing over stack overflow /oracle/IBM docs website or any learning platform its taking it as offline hours.

Other than company website its taking it as offline hours.

And My manager telling me to complete 9 hrs in work time which is on company website only and it is not possible for me to do.

From last 2 week am sitting infront of system for approx 13 hrs/day (including browsing hrs)

Note:- 1) i am not using youtube/netflix or any other OTT platforms to spend approx 13 hrs/day.
2) Even i tried all the ways to keep system on at all time and no outcome of it.

Kindly suggest me how to tackle this.

TIA"

@RamprakashGovindaraj
Copy link

RamprakashGovindaraj commented Sep 15, 2021

works like a charm!! thanks @valdergallo and @sriramkannan95

@ashishkel
Copy link

ashishkel commented Oct 19, 2021

Nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment