Sign in to follow this  
Followers 0
Guest Skleroz

How to check computer locked/unlocked?

4 posts in this topic

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

Share this post


Link to post
Share on other sites



You can check if the unlock windows is active using WinWatActive. Pausing the application is going to be the hard part of that script.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

I can't find out this window attributes, because computer is locked.

Visible window title does not work in my tryouts :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

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