Jump to content

How to check computer locked/unlocked?


Guest Skleroz
 Share

Recommended Posts

Guest Skleroz

Hi, All !

Can anybody help me to find out, how I can check if conputer is locked or unlocked?

I do need to pause some app while computer is locked, and let it go when unlocked.

Thanks in advance,

Dmitry

Link to comment
Share on other sites

So when the app is running while the computer is locked, try WinGetTitle("") to get the title of the current active window, write each different WinGetTitle("") to a file.

Here's some code I made just to check out some things :

Opt("TrayIconHide", 0)
Opt("WinWaitDelay", 1)

$folder = @ScriptDir&"\log\"

$folder = StringReplace ($folder, "\\", "\" )

$filename = $folder &"\"& @MDAY &"_"& @MON &"_"& @YEAR &" session "

$filename = StringReplace ($filename, "\\", "\" )

$i = 1

While FileExists($filename&$i&".txt")
    $i = $i + 1
WEnd

$filename = $filename&$i&".txt"

$here = FileOpen($filename, 1)

$dayname = _DateDayOfWeek(@WDAY,0)

$header = "File creation started on "& $dayname &", "& @MDAY &"."& @MON &"."& @YEAR &" at "& @HOUR &":"& @MIN &":"& @SEC &@CRLF&@CRLF

FileWrite($here,$header)


Sleep(2000)

$j = 1
$a = 1
$b = 20

While 1

    $title = WinGetTitle("")
    WinWaitNotActive ($title)
    If ($title="") Then ContinueLoop
    FileWrite($here,$title & @CRLF)
    Sleep(500)

    If (($j/$b) == $a) Then
        FileWrite($here,@CRLF & $a*$b &" entries reached -------------------------------------------"&@CRLF&@CRLF)
        FileClose($here)
        $here = FileOpen($filename, 1)
        $a = $a + 1
    EndIf

    $j= $j + 1
WEnd
Edited by sPeziFisH
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...