Jump to content

Time Lock - V2


Skrip
 Share

Recommended Posts

Hey, this is the second version of my TimeLock script. I can't find a link to version one, so..yeah. This will have to do.

Must be constantly called to work correctly. I designed this for iTunes, because...reasons...but change the varible $win to your window title.

#NoTrayIcon
$win = "iTunes"
$winl = "Locked. Enter Password"
$lock = 1
While 1
    If $lock = 1 Then
        If WinActive($win) = 1 or WinActive($winl) = 1 Then
            WinSetTitle($win, "", $winl)
            WinSetState($winl, "", @SW_RESTORE)
            WinSetState($winl, "", @SW_MINIMIZE)
            WinSetState($winl, "", @SW_DISABLE)
            $pass = InputBox("Please enter the password for this window!", "Please enter the password to view this window!", "", "*")
            _time_pass()
        EndIf
    EndIf
WEnd

Func _go()
    $time = TimerInit()
    While 1
        If TimerDiff($time) > 1000*60*30 Then
            $lock = 1
            ExitLoop
        EndIf
    WEnd
EndFunc   ;==>_go

Func _time_pass()
    If @HOUR > 12 Then
        $hour = @HOUR - 12
    EndIf
    $min = StringRight(@MIN, 1)
    $time_12 = $hour * $hour + $min
    If $pass = $time_12 Then
        WinSetTitle($winl, "", $win)
        WinSetState($win, "", @SW_RESTORE)
        WinSetState($win, "", @SW_ENABLE)
        $lock = 0
        _go()
    Else
        MsgBox(0, "", "Wrong.")
    EndIf
EndFunc

This is useful because it rotates the password. It is never the same, it's always different at every minute of the day.

To calculate the password, you do

<hour> * <hour> + <first digit of the minutes>

Example: The time is 9:41. You do, 9 * 9 + 1, so the password is 82.

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

Thank you! And my bad. How'd I type that wrong? lol...

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

2.If the windows opened by users twice,how can it lock?It only lock the Window once.{Newly Edit:Never exit the loop can do nothing.}

Thank you,you give us a very good idea.I like play games,it's useful.

About my 2nd question,I insert code into Func _time_pass(),I can open another windows,too. :D And I cannot input the password now. :D

Do      
WinClose($win)
    Until $pass = $time_12
Link to comment
Share on other sites

Thanks guys. And Au3Newbie...I only understood like...half of what you said..What exactly is your question?

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

Thanks guys. And Au3Newbie...I only understood like...half of what you said..What exactly is your question?

Sorry.I edit the topic above.

But if the windows "iTunes" was locked,why not open another?:D

Wish a good solution.Thank you very much.

Link to comment
Share on other sites

Ohh..I see what you mean.

I'll edit my script when I have some time to prevent this. Thanks for pointing that out.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

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...