; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: Dan H-L ; ; Script Function: ; Countermeasure for auto-logoff scripts on cluster computers. ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include ; Set options Opt("GUIOnEventMode", 1) $is_active = 0 $curr_direc = 0 $curr_delay = 45000 $timer = TimerInit() $window = GUICreate("Mouse", 120, 90) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ; button $button = GUICtrlCreateButton("Start", 30, 10, 60) GUICtrlSetOnEvent($button, "Click") ; slider GUICtrlCreateLabel("Delay:", 10, 45) $slider = GUICtrlCreateSlider(45, 50, 70, 30) GUICtrlSetData($slider, 15) $period = GUICtrlCreateLabel("45 s", 10, 65) GUICtrlSetOnEvent($slider, "Change") GUISetState(@SW_SHOW) $last_pos = MouseGetPos() While 1 $aux_pos = MouseGetPos() If $is_active > .5 And $last_pos[0] = $aux_pos[0] And $last_pos[1] = $aux_pos[1] And TimerDiff($timer) + 1000 >= $curr_delay Then Select Case $curr_direc = 0 MouseMove($last_pos[0] + 10, $last_pos[1]) Case $curr_direc = 1 MouseMove($last_pos[0], $last_pos[1] + 10) Case $curr_direc = 2 MouseMove($last_pos[0] - 10, $last_pos[1]) Case $curr_direc = 3 MouseMove($last_pos[0], $last_pos[1] - 10) Case $curr_direc = 4 MouseMove($last_pos[0], $last_pos[1]) $timer = TimerInit() EndSelect $curr_direc = Mod($curr_direc + 1, 5) ElseIf $last_pos[0] <> $aux_pos[0] Or $last_pos[1] <> $aux_pos[1] Then $timer = TimerInit() $curr_direc = 0 EndIf $last_pos = MouseGetPos() ; Idle around If $curr_direc = 0 Then Sleep(3000) Else Sleep(100) EndIf WEnd Func Click() If $is_active > .5 Then $is_active = 0 $curr_direc = 0 GUICtrlSetData($button, "Start") Else $is_active = 1 $curr_direc = 0 GUICtrlSetData($button, "Stop") $timer = TimerInit() EndIf EndFunc ;==>Click Func Change() GUICtrlSetData($period, String(GUICtrlRead($slider) * 3) & " s") $curr_delay = GUICtrlRead($slider) * 3000 EndFunc ;==>Change Func CLOSEClicked() If @GUI_WinHandle = $window Then Exit EndIf EndFunc ;==>CLOSEClicked ; ---------------------------------------------------------------------------- ; ; ----------------------------------------------------------------------------