Von-Wegner

Warcraft Multiboxing 2021 POLICY Compliant

Nov 5th, 2020 (edited)
1,978
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;-------------------------------------------------------------------------------
  2. ; [Autohotkey-Skript]
  3. ; Warcraft Multiboxing 2021 POLICY Compliant (Blizzard Entertainment - 3 November 2020)
  4. ; @author Florian Wegner <pastebin@von-wegner.de>
  5. ; @version 1.0.2
  6. ;-------------------------------------------------------------------------------
  7.  
  8. winPrefix := "wow"  ; Enter the initial name of the window here (without a number)
  9. winCount = 4        ; Enter the number of windows here  
  10. winActiv = 1        ; Don `t change!
  11.  
  12. ; // Start Script
  13. winTitle := "World of Warcraft"     ; Don `t change!
  14. winExe := "C:\Program Files (x86)\World of Warcraft\_retail_\Wow.exe"
  15. winExeParameter := ""               ; Don `t change!
  16.  
  17. loginPassword := "YOUR PASSWORD"    ; PASTE YOUR PASSWORD HERE
  18. autoLogin = false                   ; Automatic login with your password
  19. autoResize = false                  ; Automatic alignment of the windows (Requires a third party program)
  20. guard := windowsFocusGuard()        ; Don `t change!
  21.  
  22. F1::focusNextWin()                  ; F1 Next Warcraft Account
  23. F2::focusPreviousWin()              ; F2 Previous Warcraft Account
  24. F3::focusFirstWin()                 ; F3 First Warcraft Account
  25. ^!l::startupWindows()               ; Strg + ALT + L  Startup Windows
  26.  
  27. ; ^ = Strg  | ! = Alt
  28. ; true = ON | 0 = OFF
  29. ; -----------------------------------------------------
  30.  
  31. ; removes the tooltip
  32. ; @return void
  33. RemoveToolTip:
  34. ToolTip
  35. return
  36.  
  37. ; Set inActive for the next window
  38. ; @return bool
  39. focusNextWin() {
  40.     global winActiv
  41.     nextInt := winActiv + 1
  42.     nextWinName := buildNewWinName(nextInt)
  43.     if (switchWindowFocus(nextWinName) = true) {
  44.         setVarWinActiv(nextInt)
  45.         ToolTip, %nextWinName%
  46.         SetTimer, RemoveToolTip, -5000
  47.         return, true
  48.     }
  49.     else {
  50.         focusFirstWin()
  51.         return, 0
  52.     }
  53. }
  54.  
  55. ; Set inActive for the previous window
  56. ; @return bool
  57. focusPreviousWin() {
  58.     global winActiv
  59.     nextInt := winActiv - 1
  60.     nextWinName := buildNewWinName(nextInt)
  61.     if (switchWindowFocus(nextWinName) = true) {
  62.         setVarWinActiv(nextInt)
  63.         ToolTip, %nextWinName%
  64.         SetTimer, RemoveToolTip, -5000
  65.         return, true
  66.     }
  67.     else {
  68.         focusLasttWin()
  69.         return, 0
  70.     }
  71. }
  72.  
  73. ; Set inActive for the first window
  74. ; @return bool
  75. focusFirstWin() {
  76.     nextInt := setVarWinActiv(1)
  77.     nextWinName := buildNewWinName(nextInt)
  78.     if (switchWindowFocus(nextWinName) = true) {
  79.         ToolTip, %nextWinName%
  80.         SetTimer, RemoveToolTip, -5000
  81.         return, true
  82.     }
  83.     else {
  84.         MsgBox % "ERROR! Missing Window: " . nextWinName
  85.         return, 0
  86.     }
  87. }
  88.  
  89. ; Set inActive for the last window
  90. ; @return bool
  91. focusLasttWin() {
  92.     global winCount
  93.     nextInt := setVarWinActiv(winCount)
  94.     nextWinName := buildNewWinName(nextInt)
  95.     if (switchWindowFocus(nextWinName) = true) {
  96.         ToolTip, %nextWinName%
  97.         SetTimer, RemoveToolTip, -5000
  98.         return, true
  99.     }
  100.     else {
  101.         MsgBox % "ERROR! Missing Window: " . nextWinName
  102.         return, 0
  103.     }
  104. }
  105.  
  106. ; Save the active window
  107. ; @param newInt INT Validate that
  108. ; @return INT winActiv
  109. setVarWinActiv(newInt) {
  110.     global winActiv
  111.     global winCount
  112.     if (newInt > winCount OR newInt == 1) {
  113.         winActiv := 1
  114.     }
  115.     else if (newInt < 1) {
  116.        winActiv := winCount
  117.     }
  118.     else if (newInt > 1) {
  119.        winActiv := newInt
  120.     }
  121.     else  {
  122.         MsgBox % "INT ERROR! Debug: " . newInt
  123.     }
  124.     return winActiv
  125. }
  126.  
  127. ; Get new window name (by counter)
  128. ; @param counter INT
  129. ; @return string
  130. buildNewWinName(counter) {
  131.     global winPrefix
  132.     return, winPrefix . counter
  133. }
  134.  
  135. ; Focus to the specified window
  136. ; @param winName string Title of the target window
  137. ; @return bool
  138. switchWindowFocus(winName) {
  139.     WinHandle := WinExist(winName)
  140.     if (WinHandle) {
  141.         WinActivate
  142.         return, true
  143.     }
  144.     else  {
  145.         return, 0
  146.     }
  147. }
  148.  
  149.  
  150. ; --------------------------------------------------------------------------------------------
  151. ; startup script section
  152.  
  153. ; Starts all required instances / windows (by counter)
  154. ; @return void
  155. startupWindows() {
  156.     global winCount
  157.     global winPrefix
  158.     global winTitle
  159.     global winExe
  160.     global winExeParameter
  161.     i:=0
  162.     while(i < winCount)
  163.     {
  164.         winName := buildNewWinName(i+1)
  165.         WinHandle := WinExist(winName)
  166.         if (WinHandle) {
  167.             ToolTip, Already open: %winName%
  168.         }
  169.         else {
  170.            ToolTip, open: %winName%
  171.            if (winExeParameter == "") {
  172.                tempParameter := "-config Config-" . winPrefix . i + 1  . ".wtf"
  173.            } else {
  174.                tempParameter := winExeParameter
  175.            }
  176.            tempParameter := "-config Config-" . winPrefix . i + 1  . ".wtf"
  177.            startAndRenameWin(winName, winTitle, winExe, tempParameter)
  178.  
  179.         }
  180.  
  181.         Sleep 1200
  182.         i++
  183.     }
  184.     ToolTip FINISHED! Have fun with multiboxing
  185.     SetTimer, RemoveToolTip, -12000
  186.     return
  187. }
  188.  
  189. ; Starts and renames an instance / window
  190. ; @param newTitle String Use this name for the title
  191. ; @param title String Original title of how the program was started
  192. ; @param exe String Path to the program including exe
  193. ; @param parameter String exe start parameters (void String ("") = Warcraft Preset)
  194. ; @return void
  195. startAndRenameWin(newTitle, title, exe, parameter) {
  196.     global autoLogin
  197.     global autoResize
  198.  
  199.     Run, %exe% %parameter%
  200.     ToolTip, Waiting for the window %title% (%newTitle%)
  201.  
  202.     WinWait, %title%, , 10
  203.     WinWaitActive, %title%, , 5
  204.  
  205.     sleep 500
  206.     WinActivate, %title%
  207.  
  208.     sleep 500
  209.     ToolTip, rename to %newTitle%
  210.     WinSetTitle, %newTitle%
  211.  
  212.     if (autoLogin) {
  213.         loginInFocusedWin()
  214.     }
  215.     if (autoResize) {
  216.         sleep 500
  217.         Send ^!{NumpadSub}
  218.         sleep 500
  219.     }
  220.     return
  221. }
  222.  
  223. ; Log in automatically in the active window with the password
  224. ; @return void
  225. loginInFocusedWin() {
  226.     global loginPassword
  227.     ToolTip, Logging in..
  228.     sleep 1000
  229.     SendInput %loginPassword%
  230.     sleep 500
  231.     Send {ENTER}
  232.     sleep 500
  233.     return
  234. }
  235.  
  236.  
  237. ; --------------------------------------------------------------------------------------------
  238. ; Mouse support section (Guardian needed "guard := windowsFocusGuard()" from above)
  239.  
  240. ; Starts a Guard to react to the change of focus on the window
  241. ; @OnMessage ShellMessage()
  242. ; @return bool
  243. windowsFocusGuard() {
  244.     Gui +LastFound
  245.     hWnd := WinExist()
  246.     DllCall( "RegisterShellHookWindow", UInt,Hwnd )
  247.     MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
  248.     OnMessage( MsgNum, "ShellMessage" )
  249.     Return true
  250. }
  251.  
  252. ; Filters the messages by focus and active window and forwards them to checkFocusedWinIsTarget()
  253. ; @return void
  254. ShellMessage(wParam, lParam)
  255. {
  256.  WinGetTitle, title, ahk_id %lParam%
  257.  If (wParam = 4 OR wParam = 32772 ) { ;//HSHELL_WINDOWACTIVATED OR 0x8004; HSHELL_RUDEAPPACTIVATED
  258.   checkFocusedWinIsTarget(title)
  259.  }
  260.  return
  261. }
  262.  
  263. ; Check if the active window is one of the created instances
  264. ; @return bool
  265. checkFocusedWinIsTarget(aktivWinTitle) {
  266.     global winCount
  267.     i:=0
  268.     while(i < winCount)
  269.     {
  270.         myInt := i+1
  271.         myWinName := buildNewWinName(myInt)
  272.         if (myWinName == aktivWinTitle) {
  273.             ToolTip, %myWinName%
  274.             SetTimer, RemoveToolTip, -5000
  275.             setVarWinActiv(myInt)
  276.             return true
  277.         }
  278.         Sleep 2
  279.         i++
  280.     }
  281.     return false
  282. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×