Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance, Force
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ;~ #Warn ; Recommended for catching common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- SetTitleMatchMode, 2 ; Fast|Slow|RegEx|1|2|3
- ; ****************
- ; Variables
- ; ****************
- ; Put Variables in here
- ;~ Notepad for testing
- ;~ *** To Run other progrm un-commnt their line
- ;~ Program := "Notepad" ; or your language name for Notepad as displayed in the titlebar!
- ;~ Program := "Overwatch"
- Program := "Warcraft"
- IfEqual, Program, Notepad,
- Target := "C:\Windows\system32\notepad.exe"
- IfEqual, Program, Overwatch
- Target := "F:\Overwatch\Overwatch.exe"
- IfEqual, Program, Warcraft
- Target := "C:\Users\Public\Public Games\World of Warcraft\_retail_\Wow.exe"
- #include, Creds.ini
- ;~ Credentials have now been moved to their own support file "Creds.ini"
- ;~ Creds.ini must be in the same folder with the main script.
- global ProgID := ""
- global ProgList := []
- ;~ *** Screen Dimentions & Taskbar Hiding ***
- tb=40 ; *** Adjust if your taskbar is a different height ***
- ;~ tb=0 ; *** "0" if your Taskbar is set to "autohide" or you wish to hide your Taskbar to use all available screen space. ***
- IfEqual, tb, 0, WinHide ahk_class Shell_TrayWnd
- else
- WinShow ahk_class Shell_TrayWnd
- W=%A_ScreenWidth%
- H=%A_ScreenHeight%
- H:=H-tb
- GroupAdd, Games, ahk_class TankWindowClass
- ; ****************
- ; Script
- ; ****************
- ;~ /*
- InputBox, Num, Open Programs, "How many programs do you want to open?",,,,,,,, 12
- ;~ Check for, and load required number of games
- WinGet, ProgID, List, %Program% ; Detect how many open already
- while ProgID < Num
- {
- run %Target%
- WinWaitActive, %Program%
- WinMinimize, %Program%
- WinGet, ProgID, List, %Program%
- } ToolTip, %ProgID%
- */
- WinGet, ProgID, List, %Program% ; Dete
- Loop %ProgID%
- ProgList.push(ProgID%A_Index%)
- ;~ /*
- ;~ Lay out games
- Win_X := Win_Y := "0"
- Loop % ProgList.Length() ;%ProgID%
- {
- game := ProgList[A_Index]
- WinActivate, ahk_id %game%
- WinSet, Style, -0xC00000,ahk_id %game% ; Remove titlebar & borders
- WinMove, ahk_id %game%,,Win_X, Win_Y,W/4,H/3
- Win_Y += H/3
- if Win_Y >= %H% ; Floor(Sqrt(ProgList.Length())
- {
- Win_Y := "0" ; Win_Y += H/3
- Win_X += W/4
- }
- }
- */
- ;~ /*
- ;~ Login games
- MsgBox, all games loaded and layed out correctly?
- SetKeyDelay, 100, 30
- Loop % ProgList.Length()
- {
- game := ProgList[A_Index]
- ;~ WinActivate, ahk_id %game%
- WinGetPos, Cur_X, Cur_Y, Width, Height, ahk_id %game%
- WinMove, ahk_id %game%,, A_ScreenWidth * 0.24, A_ScreenHeight * 0.3,Width*2,Height*2
- User := Creds[A_Index][1]
- Pass := Creds[A_Index][2]
- ControlSend,, %User%{Tab}%Pass%{Enter}, ahk_id %game%
- WinMove, ahk_id %game%,, Cur_X, Cur_Y, W/4, H/3
- } SetKeyDelay, -1, -1
- */
- ; ****************
- ; Hotkeys
- ; ****************
- $W:: Multi("w")
- $A:: Multi("a")
- $S:: Multi("s")
- $D:: Multi("d")
- $Q:: Multi("q")
- $E:: Multi("e")
- $B:: Multi("b")
- BS:: Multi("BS")
- DEL:: Multi("Del")
- ;~ *** Show or Hide Taskbar ***
- ^#!H::WinHide ahk_class Shell_TrayWnd
- ^#!t::WinShow ahk_class Shell_TrayWnd
- ; *** Logout Toons ***
- +F12::
- Send, /
- Sleep, 100
- Send, logout{ENTER}
- return
- ; *** Exit Games ***
- ^#F12:: WinClose ; *** Exit current active game ***
- ^#!F12:: WinClose ahk_group Games ; *** Exit all games ***
- ; ****************
- ; Functions
- ; ****************
- ; Functions here
- ;~ /*
- Multi(key)
- {
- pr := "1"
- while pr
- {
- ToolTip, Down
- Loop % ProgList.length()
- {
- game := ProgList[A_Index]
- ControlSend,, {%key% Down}, ahk_id %game%
- ToolTip, Down
- }
- pr := GetKeyState(key, "P")
- }
- Loop % ProgList.length()
- {
- game := ProgList[A_Index]
- ControlSend,, {%key% Up}, ahk_id %game%
- ToolTip, Down
- }
- ToolTip, Up
- return
- }
- */
- ; ****************
- Pause::Suspend
- ^F11:: Menu, Tray, Icon
- ^F12:: Menu, Tray, NoIcon
- #ifwinactive ahk_class Notepad
- ~^s::
- #ifwinactive ahk_class Notepad++
- ~^s::
- #ifwinactive ahk_class SciTEWindow
- ~^s::
- Sleep, 500
- ; Checks for changes to the saved script.
- FileGetTime, NewModTime, %A_ScriptName%, M
- isIt := A_Now-NewModTime
- IfLessOrEqual, isIt, 2, Reload
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement