Screen lock

Aug 16, 2008
124
0
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,557
26
Solon, OH, USA
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
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)