Sign in to follow this  
Followers 0
comradeb14ck

Screen Saver / Lock Recognition

3 posts in this topic

Hi there. Just wondering if anyone knows of a way that I can tell whether or not the screen is locked and/or if the screensaver is on? Thanks.

Share this post


Link to post
Share on other sites



Hi there. Just wondering if anyone knows of a way that I can tell whether or not the screen is locked and/or if the screensaver is on? Thanks.

HotKeySet("{Esc}", "Quit")
While 1
    Sleep(100)
    If isScreensaverOn() Then
        MsgBox(0, "", "It is on!")
        Exit (0)
    EndIf
WEnd

Func isScreensaverOn()
   ; 1 = on , 0 = off
    Local $list = ProcessList()
    For $i = 1 To $list[0][0]
        If StringInStr($list[$i][0], ".scr") Then Return 1
    Next
    Return 0
EndFunc  ;==>isScreensaverOn

Func Quit()
    Exit
EndFunc  ;==>Quit

While 1
    Sleep(1000)
    If _isWorksatationLocked() Then ConsoleWrite(@HOUR & ":" & @MIN & ":" & @SEC & " - " & "workstation locked" & @CRLF)
WEnd

Func _isWorksatationLocked()
    If StringInStr(WinGetText(""), "Program Manager") <> 0 And WinGetTitle("") = "" Then Return 1
    Return 0
EndFunc  ;==>_isWorksatationLocked

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Thank you. Worked great. These functions should be included in the user defined sections of the language.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0