Jump to content

IdleIt


GtaSpider
 Share

Recommended Posts

hey there,

Just a little quick'n'dirty UDF that allowes you to hook the idle status of your computer. (_Timer_GetIdleTime)

You have a _Idle func that calls on idle (you can set the idle time manually) and you also have a _Back func, that calls when the user is back.

Well, as i said: Its quick'n'dirty, but i hadnt found a nicer way to do that.

Hope you anjoy it anyways

Current Version: 1.0

Example (also in the ZIP File)

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include "IdleIt.au3"

HotKeySet("{ESC}","_exit")

_IdleIt_Initalize(5);When nothing happen in 5 seconds, the IDLE Func will call
_IdleIt_Hook($IDLEIT_IDLE,"_idle");Hook the Idle func
_IdleIt_Hook($IDLEIT_BACK,"_back"); hook the back func

;just create a small example gui
$hMain = GUICreate("",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP,$WS_EX_TOPMOST)
GUICtrlCreateLabel("Move mouse or type keyboard or whatever to unlock screen"&@CRLF&"ESC to Exit",0,(@DesktopHeight/2) - 50,@DesktopWidth,100,$SS_CENTER)
GUICtrlSetColor(-1,0xffffff)
guictrlsetfont(-1,30)
WinSetTrans($hMain,"",0)
GUISetBkColor(0)

;and now.... do nothing
While 1
    Sleep(1000)
WEnd



Func _idle()
    ;ah, it seems like the user is away... lets show the black gui
    GUISetState()
    For $i = 0 To 150 Step 5
        WinSetTrans($hMain,"",$i)
        Sleep(10)
    Next
EndFunc

Func _back()
    ;Oh! Welcome back user! Hide the balck gui now
    For $i = 150 To 0 Step -5
        WinSetTrans($hMain,"",$i)
        Sleep(10)
    Next
    GUISetState(@SW_HIDE)
EndFunc


Func _exit()
    ;bye for now
    Exit
EndFunc

Greetings from Germany,

Spider

IdleIt v1.0.zip

www.AutoIt.de - Moderator of the German AutoIt Forum

 

Link to comment
Share on other sites

  • 2 weeks later...

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