jaberwacky Posted September 4, 2013 Share Posted September 4, 2013 (edited) Once again for lack of a better title.If you make TrueCrypt volumes then you may not like having to move the mouse randomly within the window for at least thirty seconds. So I automated the process. The time is set to one-hundred and twenty seconds but can be easily changed by editing the $time_limit_seconds constant. Requires latest AutoIt beta.expandcollapse popup#AutoIt3Wrapper_Version=B #autoit3Wrapper_jump_to_first_error=y #AutoIt3Wrapper_Run_AU3Check=n #AutoIt3Wrapper_Run_Tidy=n #include <StructureConstants.au3> #include <WinAPI.au3> HotKeySet("{ESC}", _exit) _main(120) Func _main(Const $time_limit_seconds) Local Const $true_crypt_title = "TrueCrypt Volume Creation Wizard" Switch WinExists($true_crypt_title) Case True WinActivate($true_crypt_title) Local Const $true_crypt_position = WinGetPos($true_crypt_title) Local Const $left = $true_crypt_position[0] Local Const $top = $true_crypt_position[1] Local Const $right = $true_crypt_position[2] + $left Local Const $bottom = $true_crypt_position[3] + $top BlockInput(1) _MouseTrap($left, $top, $right, $bottom) Local $x, $y, $speed, $time_elapsed Local Const $time = TimerInit() Do $x = Random($left, $right, 1) $y = Random($top, $bottom, 1) $speed = Random(1, 10, 1) MouseMove($x, $y, $speed) $time_elapsed = TimerDiff($time) / 1000 ;ConsoleWrite("X: " & $x & @TAB & "Y: " & $y & @TAB & "Seconds: " & Int($time_elapsed) & @crlf) Switch $time_elapsed >= $time_limit_seconds Case True BlockInput(0) _MouseTrap() ExitLoop EndSwitch Until False EndSwitch EndFunc ; #FUNCTION# ==================================================================================================================== ; Author ........: Gary Frost (gafrost) ; Modified.......: Jaberwacky ; =============================================================================================================================== Func _MouseTrap(Const $iLeft = 0, Const $iTop = 0, Const $iRight = 0, Const $iBottom = 0) If @NumParams = 0 Then Local Const $aReturn = DllCall("user32.dll", "bool", "ClipCursor", "ptr", 0)[0] If @error Or Not $aReturn Then Return SetError(1, _WinAPI_GetLastError(), False) EndIf Return True Else Local Const $tRect = DllStructCreate($tagRECT) DllStructSetData($tRect, "Left", $iLeft) DllStructSetData($tRect, "Top", $iTop) DllStructSetData($tRect, "Right", $iRight) DllStructSetData($tRect, "Bottom", $iBottom) Local Const $aReturn = DllCall("user32.dll", "bool", "ClipCursor", "struct*", $tRect)[0] If @error Or Not $aReturn Then Return SetError(2, _WinAPI_GetLastError(), False) EndIf EndIf Return True EndFunc Func _exit() Exit EndFuncEnjoy! [06/02/2015] -- Added WinActivate(). Edited June 2, 2015 by jaberwacky Edited code Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted June 2, 2015 Author Share Posted June 2, 2015 updated Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now