Screen lock

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Aug 16, 2008
124
0
#3
Thanks, that should be the one I'm looking for. Unfortunately the following doesn't work:
do forever
iff %_WINFGWINDOW != "" then
beep 440 2
endiff
delay 1
enddo

...meaning it also beeps when I lock the screen. Strangely, echoing %_WINFGWINDOW in locked state emits "ECHO is OFF", so it should be a null string when the screen is locked.
 

samintz

Scott Mintz
May 20, 2008
1,204
11
Solon, OH, USA
#6
According to the MS Scripting Guy, there's
no definitive way. The example they used was to see if the screen
saver was running.

To do that in TCC, query the registry
for the name of the screen saver:

echo %@regquery["hkcu\control panel\desktop\SCRNSAVE.EXE"]

And check to see if it is running:

iff %@PID[%@filename[%@regquery["hkcu\control
panel\desktop\SCRNSAVE.EXE"]]] == 0 then
echo
Screen saver is not running
else
echo
Screen saver is running
endiff

-Scott



How can I check in a script whether the
screen is locked?
 
Aug 16, 2008
124
0
#7
According to the MS Scripting Guy, there's
no definitive way. The example they used was to see if the screen
saver was running.

And check to see if it is running:

iff %@PID[%@filename[%@regquery["hkcu\control
panel\desktop\SCRNSAVE.EXE"]]] == 0 then
That's not going to work. I for instance have Webshots running and the application that changes the desktop background is the screen saver (webshots.scr). That means webshots.scr (=SCRNSAVE.EXE) is always running - even when the screen saver is not running.

Interestingly "%@winsystem[114]" (SPI_GETSCREENSAVERRUNNING) does also not work (always returns 0)