Code:
#cs
AutoIt Version: 3.0
Language: English
Platform: Win xx
Author: Glommy
Ver. 1.0
Need:
Included:
.exe and .Au3 -source
Tested:
Three WinterBuddy + Neverwinter runs 24 hours with out AFK behaviour.
Problems:
Windows "popup" can cause nerve breakdown!!!
Script Function:
AntiAFK for WinterBuddy.
Send "Alt+W" to "Neverwinter" windows.
Pick up automaticly new process.
HOTKEYS,
PAUSE/Break, pause
Alt+LShift+T, Terminata script
Alt+LShift+D, shows just pop up.
#ce
; Press Esc to terminate script, Pause/Break to "pause"
Global $Paused
HotKeySet("å", "TogglePause")
HotKeySet("+!t", "Terminate") ; shift alt t, terminat
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d vvv
Opt("WinTitleMatchMode", "2") ; Helps With Getting The Window Information...
Opt("SendKeyDownDelay", 50) ;50 millisecond, fs
AutoItSetOption("MouseClickDownDelay", 500)
;;;; Body of program would go here ;;;;
;TogglePause()
Sleep(15000)
While 1 ; all parts are in "loop" so script looks allways if new stuff drops in
Local $var = WinList("Neverwinter") ;this makes list for active windows by name
For $i = 1 To $var[0][0] ; we run until list is end
; Only display visble windows that have a title
If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then
$handle = ($var[$i][1])
$title = ($var[$i][0])
WinActivate(HWnd($handle)) ; windows to activate
$WinLoc = WinGetPos($title, "") ; get active windows position
$iX = $WinLoc[0] + ($WinLoc[2] / 2) ; The "X" Pos For The Mouse To Click
$iY = $WinLoc[1] + ($WinLoc[3] / 2) ; The "Y" Pos For The Mouse To Click
$iButton = "left" ; Button The Mouse Will Click I.E. "Left Or Right"
$iClicks = "1" ; The Number Of Times To Click1
;ControlClick($title, "", $handle, $iButton, $iClicks, $iX, $iY) ; Clicking The Window While Its Minmized, controlclick not working, WHY?
;Send("{SPACE}")
Sleep(10)
MouseClick("LEFT")
Send("{TAB}")
Sleep(10)
MouseClick("LEFT")
Send("1")
Sleep(10)
MouseClick("LEFT")
Sleep(10)
MouseClick("LEFT")
Sleep(10)
Send("r")
Sleep(10)
MouseClick("LEFT")
Sleep(10)
Send("e")
Sleep(10)
MouseClick("LEFT")
Sleep(10)
Send("q")
;ControlSend($title, "", $handle, "!F", "")
Sleep(10)
Send("e")
;ControlSend($title, "", $handle, "!F", "")
Sleep(10)
;Send("{LALT}")
Send("F")
Sleep(10)
Send("3")
Sleep(10)
Send("7")
;ControlSend($title, "", $handle, "!F", "")
;Sleep(5)
;Send("F")
;ControlSend($title, "", $handle, "!F", "")
;Sleep(5)
;Send("F")
EndIf
Sleep(Random(100, 250, 1))
Next
Sleep(Random(500, 1500, 1))
WEnd
Func IsVisible($handle)
If BitAND(WinGetState($handle), 2) Then
Return 1
Else
Return 0
EndIf
EndFunc ;==>IsVisible
;;;;;;;;
Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(100)
ToolTip('Script is "Paused"', 5, 5)
WEnd
ToolTip("")
EndFunc ;==>TogglePause
Func Terminate()
#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Critical, Timeout=5 ss, Miscellaneous=Top-most attribute
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(262160, "Note", "Script is about to Terminate.", 5)
Select
Case $iMsgBoxAnswer = -1 ;Timeout
Case Else ;OK
EndSelect
#EndRegion --- CodeWizard generated code Start ---
Exit 0
EndFunc ;==>Terminate
Func ShowMessage()
MsgBox(4096, "", "This is a message.")
EndFunc ;==>ShowMessage