Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;-------------------------------------------------------------------------------
- ; [Autohotkey-Skript]
- ; Warcraft Multiboxing 2021 POLICY Compliant (Blizzard Entertainment - 3 November 2020)
- ; @author Florian Wegner <pastebin@von-wegner.de>
- ; @version 1.0.2
- ;-------------------------------------------------------------------------------
- winPrefix := "wow" ; Enter the initial name of the window here (without a number)
- winCount = 4 ; Enter the number of windows here
- winActiv = 1 ; Don `t change!
- ; // Start Script
- winTitle := "World of Warcraft" ; Don `t change!
- winExe := "C:\Program Files (x86)\World of Warcraft\_retail_\Wow.exe"
- winExeParameter := "" ; Don `t change!
- loginPassword := "YOUR PASSWORD" ; PASTE YOUR PASSWORD HERE
- autoLogin = false ; Automatic login with your password
- autoResize = false ; Automatic alignment of the windows (Requires a third party program)
- guard := windowsFocusGuard() ; Don `t change!
- F1::focusNextWin() ; F1 Next Warcraft Account
- F2::focusPreviousWin() ; F2 Previous Warcraft Account
- F3::focusFirstWin() ; F3 First Warcraft Account
- ^!l::startupWindows() ; Strg + ALT + L Startup Windows
- ; ^ = Strg | ! = Alt
- ; true = ON | 0 = OFF
- ; -----------------------------------------------------
- ; removes the tooltip
- ; @return void
- RemoveToolTip:
- ToolTip
- return
- ; Set inActive for the next window
- ; @return bool
- focusNextWin() {
- global winActiv
- nextInt := winActiv + 1
- nextWinName := buildNewWinName(nextInt)
- if (switchWindowFocus(nextWinName) = true) {
- setVarWinActiv(nextInt)
- ToolTip, %nextWinName%
- SetTimer, RemoveToolTip, -5000
- return, true
- }
- else {
- focusFirstWin()
- return, 0
- }
- }
- ; Set inActive for the previous window
- ; @return bool
- focusPreviousWin() {
- global winActiv
- nextInt := winActiv - 1
- nextWinName := buildNewWinName(nextInt)
- if (switchWindowFocus(nextWinName) = true) {
- setVarWinActiv(nextInt)
- ToolTip, %nextWinName%
- SetTimer, RemoveToolTip, -5000
- return, true
- }
- else {
- focusLasttWin()
- return, 0
- }
- }
- ; Set inActive for the first window
- ; @return bool
- focusFirstWin() {
- nextInt := setVarWinActiv(1)
- nextWinName := buildNewWinName(nextInt)
- if (switchWindowFocus(nextWinName) = true) {
- ToolTip, %nextWinName%
- SetTimer, RemoveToolTip, -5000
- return, true
- }
- else {
- MsgBox % "ERROR! Missing Window: " . nextWinName
- return, 0
- }
- }
- ; Set inActive for the last window
- ; @return bool
- focusLasttWin() {
- global winCount
- nextInt := setVarWinActiv(winCount)
- nextWinName := buildNewWinName(nextInt)
- if (switchWindowFocus(nextWinName) = true) {
- ToolTip, %nextWinName%
- SetTimer, RemoveToolTip, -5000
- return, true
- }
- else {
- MsgBox % "ERROR! Missing Window: " . nextWinName
- return, 0
- }
- }
- ; Save the active window
- ; @param newInt INT Validate that
- ; @return INT winActiv
- setVarWinActiv(newInt) {
- global winActiv
- global winCount
- if (newInt > winCount OR newInt == 1) {
- winActiv := 1
- }
- else if (newInt < 1) {
- winActiv := winCount
- }
- else if (newInt > 1) {
- winActiv := newInt
- }
- else {
- MsgBox % "INT ERROR! Debug: " . newInt
- }
- return winActiv
- }
- ; Get new window name (by counter)
- ; @param counter INT
- ; @return string
- buildNewWinName(counter) {
- global winPrefix
- return, winPrefix . counter
- }
- ; Focus to the specified window
- ; @param winName string Title of the target window
- ; @return bool
- switchWindowFocus(winName) {
- WinHandle := WinExist(winName)
- if (WinHandle) {
- WinActivate
- return, true
- }
- else {
- return, 0
- }
- }
- ; --------------------------------------------------------------------------------------------
- ; startup script section
- ; Starts all required instances / windows (by counter)
- ; @return void
- startupWindows() {
- global winCount
- global winPrefix
- global winTitle
- global winExe
- global winExeParameter
- i:=0
- while(i < winCount)
- {
- winName := buildNewWinName(i+1)
- WinHandle := WinExist(winName)
- if (WinHandle) {
- ToolTip, Already open: %winName%
- }
- else {
- ToolTip, open: %winName%
- if (winExeParameter == "") {
- tempParameter := "-config Config-" . winPrefix . i + 1 . ".wtf"
- } else {
- tempParameter := winExeParameter
- }
- tempParameter := "-config Config-" . winPrefix . i + 1 . ".wtf"
- startAndRenameWin(winName, winTitle, winExe, tempParameter)
- }
- Sleep 1200
- i++
- }
- ToolTip FINISHED! Have fun with multiboxing
- SetTimer, RemoveToolTip, -12000
- return
- }
- ; Starts and renames an instance / window
- ; @param newTitle String Use this name for the title
- ; @param title String Original title of how the program was started
- ; @param exe String Path to the program including exe
- ; @param parameter String exe start parameters (void String ("") = Warcraft Preset)
- ; @return void
- startAndRenameWin(newTitle, title, exe, parameter) {
- global autoLogin
- global autoResize
- Run, %exe% %parameter%
- ToolTip, Waiting for the window %title% (%newTitle%)
- WinWait, %title%, , 10
- WinWaitActive, %title%, , 5
- sleep 500
- WinActivate, %title%
- sleep 500
- ToolTip, rename to %newTitle%
- WinSetTitle, %newTitle%
- if (autoLogin) {
- loginInFocusedWin()
- }
- if (autoResize) {
- sleep 500
- Send ^!{NumpadSub}
- sleep 500
- }
- return
- }
- ; Log in automatically in the active window with the password
- ; @return void
- loginInFocusedWin() {
- global loginPassword
- ToolTip, Logging in..
- sleep 1000
- SendInput %loginPassword%
- sleep 500
- Send {ENTER}
- sleep 500
- return
- }
- ; --------------------------------------------------------------------------------------------
- ; Mouse support section (Guardian needed "guard := windowsFocusGuard()" from above)
- ; Starts a Guard to react to the change of focus on the window
- ; @OnMessage ShellMessage()
- ; @return bool
- windowsFocusGuard() {
- Gui +LastFound
- hWnd := WinExist()
- DllCall( "RegisterShellHookWindow", UInt,Hwnd )
- MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
- OnMessage( MsgNum, "ShellMessage" )
- Return true
- }
- ; Filters the messages by focus and active window and forwards them to checkFocusedWinIsTarget()
- ; @return void
- ShellMessage(wParam, lParam)
- {
- WinGetTitle, title, ahk_id %lParam%
- If (wParam = 4 OR wParam = 32772 ) { ;//HSHELL_WINDOWACTIVATED OR 0x8004; HSHELL_RUDEAPPACTIVATED
- checkFocusedWinIsTarget(title)
- }
- return
- }
- ; Check if the active window is one of the created instances
- ; @return bool
- checkFocusedWinIsTarget(aktivWinTitle) {
- global winCount
- i:=0
- while(i < winCount)
- {
- myInt := i+1
- myWinName := buildNewWinName(myInt)
- if (myWinName == aktivWinTitle) {
- ToolTip, %myWinName%
- SetTimer, RemoveToolTip, -5000
- setVarWinActiv(myInt)
- return true
- }
- Sleep 2
- i++
- }
- return false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement