Code:
/*
*****************************************************************
** AHK Script: FreeBox
** Language: English
** Author: Thedonsquad
** E-mail: thedonsquad@googlemail.com
** Created: April 15, 2008
** Edited: April 20, 2008
** Revision: .29
** Status: Untested
** Specifics: Must be on system with same resolution monitors
*****************************************************************
*****************************************************************
** LAYOUT THEMES:
**
** These are categorized by how many instances are on the givin
** monitor. Currently allows for 1 to 4 instances.
**
** Value 0 means nonexistant display, and will be ignored
**
** If you have 1 instance opening on a monitor the value must be
** 1 in the LTMon for the monitor it is going in.
**
** If you have 2 instances opening on a monitor the value can be
** 1 for Horizontal Split:
** +-------+
** ¦ 1 ¦
** +-------+
** ¦ 2 ¦
** +-------+
** 2 for Vertical Split:
** +---+---+
** ¦ ¦ ¦
** ¦ 1 ¦ 2 ¦
** ¦ ¦ ¦
** +---+---+
**
** If you have 3 instances opening on a monitor the value can be
** 1 for Horizontal split with two on top:
** +---+---+
** ¦ 1 ¦ 2 ¦
** +---+---+
** ¦ 3 ¦
** +-------+
** 2 for Horizontal split with two on bottom:
** +-------+
** ¦ 1 ¦
** +---+---+
** ¦ 2 ¦ 3 ¦
** +---+---+
** 3 for Vertical split with two on left:
** +---+---+
** ¦ 1 ¦ ¦
** +---+ 3 ¦
** ¦ 2 ¦ ¦
** +---+---+
** 4 for Vertical split with two on right:
** +---+---+
** ¦ ¦ 2 ¦
** ¦ 1 +---+
** ¦ ¦ 3 ¦
** +---+---+
**
** If you have 4 instances opening on a monitor the value must be
** 1 in the LTMon for the monitor it is going in.
**
** Note: You can open a notepad or web browser window in one of
** these locations as well This is done by placing the program in
** the Game5 spot, it will be borderless and titleless as well.
*****************************************************************
*/
/*
*****************************************************************
** Launch all instances on script start
** Comment out with ; (semicolon) to take out instances
** Delete comment to enable instance
**
** Delete the comment on line prior to ifWinNotExist to disable
** automatic launch and set to the hotkey you please
**
** Note: currently not set up for OpenGL based programs, to do
** so; change "hk_class GxWindowClassD3d" to the program name
*****************************************************************
*/
; ^!+W::
ifWinNotExist, ahk_class GxWindowClassD3d
{
; Declare programs to be opened
; Note: Open each instance and turn on windowed mode but make
; sure maximized is unchecked.
Game1 := "C:\World of Warcraft\wow.exe"
Game2 := "C:\World of Warcraft1\wow.exe"
Game3 := "D:\World of Warcraft\wow.exe"
Game4 := "D:\World of Warcraft1\wow.exe"
; Game5 := "E:\World of Warcraft\wow.exe"
; Declare working directorys of programs
PATH1 := "C:\World of Warcraft\"
PATH2 := "C:\World of Warcraft1\"
PATH3 := "D:\World of Warcraft\"
PATH4 := "D:\World of Warcraft1\"
; PATH5 := "E:\World of Warcraft1\"
; Declare number of instances per monitor
; !!!DO NOT COMMENT THESE OUT!!!
; Set to 0 if nonexistant display
INMon1 := 3
INMon2 := 0
INMon3 := 0
INMon4 := 0
; Declare layout theme
; !!!DO NOT COMMENT THESE OUT!!!
; Set to 0 if nonexistant display
; See top for proper layout numbers
LTMon1 := 2
LTMon2 := 0
LTMon3 := 0
LTMon4 := 0
; Run each declared program and assign ID to variable
; Note: to improve load time, set the default resolution of
; the program to the minimum setting as it will be modified
; later anyway.
Run, %Game1%, %PATH1%, , instanceID1
Run, %Game2%, %PATH2%, , instanceID2
Run, %Game3%, %PATH3%, , instanceID3
; Run, %Game4%, %PATH4%, , instanceID4
; Run, %Game5%, %PATH5%, , instanceID5
; Wait 5 seconds for the instances to launch
; Adjust if necessary, 1000 = 1 sec
Sleep 5000
; Call function to select regions
RegionCreate()
return
}
/*
*****************************************************************
** Region Creation function
*****************************************************************
*/
RegionCreate()
{
; Pull needed global values
global INMon1 ; Instances per monitor
global INMon2
global INMon3
global INMon4
global LTMon1 ; Layout Theme for monitors
global LTMon2
global LTMon3
global LTMon4
global instanceID1 ; Game PID's
global instanceID2 ; Comment out any that aren't used above
global instanceID3
global instanceID4
; global instanceID5
MonHori := (A_ScreenHeight / 2)
MonVert := (A_ScreenWidth/ 2)
; Monitor1
if INMon1 > 0
{
if INMon1 = 1
{
; Only 1 instance, so fullscreen it
WinMove, ahk_pid %instanceID1%, , -3, -3, (A_ScreenWidth + 6), (A_ScreenHeight + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID1%
WinSet, Style, -0x40000, ahk_pid %instanceID1%
Winset, Region, 3-3 W%A_ScreenWidth% H%A_ScreenHeight%, ahk_pid %instanceID1%
}
if INMon1 = 2
{
if LTMon1 = 1
{
; 2 instances Horizontal Split
WinMove, ahk_pid %instanceID1%, , -3, -3, (A_ScreenWidth + 6), ((A_ScreenHeight / 2) + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID1%
WinSet, Style, -0x40000, ahk_pid %instanceID1%
Winset, Region, 3-3 W%A_ScreenWidth% H%MonHori%, ahk_pid %instanceID1%
WinMove, ahk_pid %instanceID2%, , -3, ((A_ScreenHeight / 2) - 3), (A_ScreenWidth + 6), ((A_ScreenHeight / 2) + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID2%
WinSet, Style, -0x40000, ahk_pid %instanceID2%
Winset, Region, 3-3 W%A_ScreenWidth% H%MonHori%, ahk_pid %instanceID2%
}
if LTMon1 = 2
{
; 2 instances Vertical Split
WinMove, ahk_pid %instanceID1%, , -3, -3, ((A_ScreenWidth /2) + 6), (A_ScreenHeight + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID1%
WinSet, Style, -0x40000, ahk_pid %instanceID1%
Winset, Region, 3-3 W%MonVert% H%A_ScreenHeight%, ahk_pid %instanceID1%
WinMove, ahk_pid %instanceID2%, , ((A_ScreenWidth / 2) - 3), -3, ((A_ScreenWidth / 2) + 6), (A_ScreenHeight + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID2%
WinSet, Style, -0x40000, ahk_pid %instanceID2%
Winset, Region, 3-3 W%MonVert% H%A_ScreenHeight%, ahk_pid %instanceID2%
}
}
if INMon1 = 3
{
if LTMon1 = 1
{
; 3 instances Horizontal split with two on top:
WinMove, ahk_pid %instanceID1%, , -3, -3, ((A_ScreenWidth / 2) + 6), ((A_ScreenHeight / 2) + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID1%
WinSet, Style, -0x40000, ahk_pid %instanceID1%
Winset, Region, 3-3 W%MonVert% H%MonHori%, ahk_pid %instanceID1%
WinMove, ahk_pid %instanceID2%, , ((A_ScreenWidth / 2) - 3), -3, ((A_ScreenWidth / 2) + 6), ((A_ScreenHeight / 2) + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID2%
WinSet, Style, -0x40000, ahk_pid %instanceID2%
Winset, Region, 3-3 W%MonVert% H%MonHori%, ahk_pid %instanceID2%
WinMove, ahk_pid %instanceID3%, , -3, ((A_ScreenHeight / 2) - 3), (A_ScreenWidth + 6), ((A_ScreenHeight / 2) + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID3%
WinSet, Style, -0x40000, ahk_pid %instanceID3%
Winset, Region, 3-3 W%A_ScreenWidth% H%MonHori%, ahk_pid %instanceID3%
}
if LTMon1 = 2
{
; 3 instances Horizontal split with two on bottom
WinMove, ahk_pid %instanceID1%, , -3, -3, (A_ScreenWidth + 6), ((A_ScreenHeight / 2) + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID1%
WinSet, Style, -0x40000, ahk_pid %instanceID1%
Winset, Region, 3-3 W%A_ScreenWidth% H%MonHori%, ahk_pid %instanceID1%
WinMove, ahk_pid %instanceID2%, , -3, ((A_ScreenHeight / 2) - 3), ((A_ScreenWidth / 2) + 6), ((A_ScreenHeight / 2) + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID2%
WinSet, Style, -0x40000, ahk_pid %instanceID2%
Winset, Region, 3-3 W%MonVert% H%MonHori%, ahk_pid %instanceID2%
WinMove, ahk_pid %instanceID3%, , ((A_ScreenWidth / 2) - 3), ((A_ScreenHeight / 2) - 3), ((A_ScreenWidth / 2) + 6), ((A_ScreenHeight / 2) + 6)
WinSet, Style, -0x800000, ahk_pid %instanceID3%
WinSet, Style, -0x40000, ahk_pid %instanceID3%
Winset, Region, 3-3 W%MonVert% H%MonHori%, ahk_pid %instanceID3%
}
}
}
if INMon2 > 0
{
}
if INMon3 > 0
{
}
if INMon4 > 0
{
}
}
Connect With Us