Jump to content
Sign in to follow this  
Guest Skleroz

How to check computer locked/unlocked?

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,


Share this post

Link to post
Share on other sites
Matt @ MPCS

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
Guest Skleroz

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

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

$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



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

While 1

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

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

    $j= $j + 1
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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.