Close
Page 1 of 2 1 2 LastLast
Showing results 1 to 10 of 15

Thread: Window ID's

  1. #1

    Default Window ID's

    My system is about to get a complete clean so I'm putting the code i've created so far up:

    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
       {
       
       }
    }
    [align=center]Quad Core 2 Extreme 3.0Ghz @ 3.2Ghz 1600Mhz FSB[/align]
    [align=center]4x 160GB SATA II -- 0+2(Raid0), 1+3(Raid0)
    4GB DDR2 1066 (5-5-5-15) -- 2x Palit 9600GT 512MB
    2x 28" Hanns-G 281 @ 1920x1200
    Vista 32 Bit Ultimate
    [/align]
    [align=center]<Hells Heroes> (US-Tich [Horde])
    Donilli, Donilil, Doniill, Doniili[/align]

  2. #2

    Default

    Is it necessary to bump all of them? Can't you just switch the current main and the new main or is it crucial you maintain the order?
    The Orcks of War
    Shaman Borck Zorck Dorck Porck Corck
    Mixed Team - Msblonde - Mswhite - Msblack - Msred - Msbrown -

  3. #3

    Default

    I do it by running a PowerShell script to get the process IDs of my running instances of WoW, sorting them by exe path, and passing the pids into AHK on the command line. (AHK can also make window groups based on process ID.) Code here if you are interested:
    [AutoHotKey] Sleep/Spread out formations
    All my codes r belong to you: wow5box

  4. #4

    Default

    Meh, I'm not trying to learn and understand 2 scripting languages. I'm about 6 hours into learning AHK and have enough funtionality to play the game viably. My goals are to create a more seamless transition from one main to another.

    No, I would not have to bump all of the ID's, but that doesn't change the need to be able to do it.
    [align=center]Quad Core 2 Extreme 3.0Ghz @ 3.2Ghz 1600Mhz FSB[/align]
    [align=center]4x 160GB SATA II -- 0+2(Raid0), 1+3(Raid0)
    4GB DDR2 1066 (5-5-5-15) -- 2x Palit 9600GT 512MB
    2x 28" Hanns-G 281 @ 1920x1200
    Vista 32 Bit Ultimate
    [/align]
    [align=center]<Hells Heroes> (US-Tich [Horde])
    Donilli, Donilil, Doniill, Doniili[/align]

  5. #5

    Default

    Yeah, it would be simpler to avoid the extra script. Post back if you get an all-AHK solution!
    All my codes r belong to you: wow5box

  6. #6

    Default

    So theres a few things that i'm discovering as i work on this little project, and most of that is the possible benfits of having the script keep track of what is active and what is not

    First : allows you to be able to clean up the send to all clones part to look something like this:

    Code:
    SendAllClone(strKeys) 
    { 
    global WoWinId1 ; declares the WoWinID(#) as global 
    global WoWinId2 ; the # associated is the ahk_id 
    global WoWinId3 ; for the corresponding list value 
    global WoWinId4 
    
    ControlSend, , %strKeys%, ahk_id %WoWinId2% 
    ControlSend, , %strKeys%, ahk_id %WoWinId3% 
    ControlSend, , %strKeys%, ahk_id %woWinId4% 
    }
    In order for the list created by WinGet function to be in the correct order at startup, have your RunWait functions call in order from last to first eg:
    Code:
    ^!+w:: 
    ifWinNotExist, World of Warcraft 
    { 
    ; Declare programs to be opened 
    WOW1 := "C:\World of Warcraft\maximizer.exe" 
    WOW2 := "C:\World of Warcraft1\maximizer.exe" 
    WOW3 := "D:\World of Warcraft\maximizer.exe" 
    WOW4 := "D:\World of Warcraft1\maximizer.exe" 
    
    ; Declare working directorys of programs 
    WOWPATH1 := "C:\World of Warcraft\" 
    WOWPATH2 := "C:\World of Warcraft1\" 
    WOWPATH3 := "D:\World of Warcraft\" 
    WOWPATH4 := "D:\World of Warcraft1\" 
    
    RunWait, %WOW4%, %WOWPATH4% 
    RunWait, %WOW3%, %WOWPATH3% 
    RunWait, %WOW2%, %WOWPATH2% 
    RunWait, %WOW1%, %WOWPATH1% 
    
    ; get the list of WoW IDs (ordered from WOW1 to WOW4 in array WoWinID) 
    WinGet, WoWinId, List, World of Warcraft 
    return 
    }
    This makes the values work as follows (oh and don't mess with the windows while they are loading (not even click on em))
    WoWinId1 = WOW1
    WoWinId2 = WOW2 and so on...
    [align=center]Quad Core 2 Extreme 3.0Ghz @ 3.2Ghz 1600Mhz FSB[/align]
    [align=center]4x 160GB SATA II -- 0+2(Raid0), 1+3(Raid0)
    4GB DDR2 1066 (5-5-5-15) -- 2x Palit 9600GT 512MB
    2x 28" Hanns-G 281 @ 1920x1200
    Vista 32 Bit Ultimate
    [/align]
    [align=center]<Hells Heroes> (US-Tich [Horde])
    Donilli, Donilil, Doniill, Doniili[/align]

  7. #7

    Default

    I am working on a script to launch WoW directly without having to use Maximizer. I am using 2 monitors and the 4 clone sessions on the 2nd monitor is pretty small so my end goal is to be able to resize/shift my WoW windows on the fly. When I change my main I can resize and reposition the main window. I am not sure if it is even possible but it would be great if it is.

    Quote Originally Posted by 'Thedonsquad',index.php?page=Thread&postID=54007#p ost54007
    Code:
    RunWait, %WOW4%, %WOWPATH4% 
    RunWait, %WOW3%, %WOWPATH3% 
    RunWait, %WOW2%, %WOWPATH2% 
    RunWait, %WOW1%, %WOWPATH1% 
    
    ; get the list of WoW IDs (ordered from WOW1 to WOW4 in array WoWinID) 
    WinGet, WoWinId, List, World of Warcraft
    You can also try:

    Code:
    global WoW1
    global WoW2
    global WoW3
    global WoW4
    
    RunWait, %WOW4%, %WOWPATH4% 
    WoW4 := ActiveWin()
    RunWait, %WOW3%, %WOWPATH3% 
    WoW3 := ActiveWin()
    RunWait, %WOW2%, %WOWPATH2% 
    WoW2 := ActiveWin()
    RunWait, %WOW1%, %WOWPATH1% 
    WoW1 := ActiveWin()
    This way you don't rely on WinGet to give you the correct order (not tested).
    The Orcks of War
    Shaman Borck Zorck Dorck Porck Corck
    Mixed Team - Msblonde - Mswhite - Msblack - Msred - Msbrown -

  8. #8

    Default

    With this approach do you have to shut down all of your copies of WoW if you want to make a change to your AHK script? It would be nice if the script checked to see if a given copy was already running and, if so, skipped re-launching it.
    All my codes r belong to you: wow5box

  9. #9

    Default

    i'm still trying to figure out how to get it to repop a crashed/killed wow, shouldn't be that difficult. updated first post with code so far.

    and the reason i'm using maximizer is just for cleanliness, i have plenty of desktop to play with but i like it clean...
    there are several reasons for using RunWait, but primarily since maximizer tends to screw up when opening multiple at once, RunWait runs maximizer, waits till it's finished and out of memory before running the next one. Also, you can declare a variable to store the PID when u run a command, but this doesn't work properly due to the fact that i'm not running wow from it. So, WinGet is a perfectly viable tool, and it just means that u wait for them all to be fully opened prior to messing with them, which is pretty easy for me since i type all the passwords in at once.
    [align=center]Quad Core 2 Extreme 3.0Ghz @ 3.2Ghz 1600Mhz FSB[/align]
    [align=center]4x 160GB SATA II -- 0+2(Raid0), 1+3(Raid0)
    4GB DDR2 1066 (5-5-5-15) -- 2x Palit 9600GT 512MB
    2x 28" Hanns-G 281 @ 1920x1200
    Vista 32 Bit Ultimate
    [/align]
    [align=center]<Hells Heroes> (US-Tich [Horde])
    Donilli, Donilil, Doniill, Doniili[/align]

  10. #10

    Default

    Quote Originally Posted by 'Thedonsquad',index.php?page=Thread&postID=54044#p ost54044
    i'm still trying to figure out how to get it to repop a crashed/killed wow, shouldn't be that difficult. updated first post with code so far.

    and the reason i'm using maximizer is just for cleanliness, i have plenty of desktop to play with but i like it clean...
    there are several reasons for using RunWait, but primarily since maximizer tends to screw up when opening multiple at once, RunWait runs maximizer, waits till it's finished and out of memory before running the next one. Also, you can declare a variable to store the PID when u run a command, but this doesn't work properly due to the fact that i'm not running wow from it. So, WinGet is a perfectly viable tool, and it just means that u wait for them all to be fully opened prior to messing with them, which is pretty easy for me since i type all the passwords in at once.
    I know what Maximizer and WinGet does. Your wow launching script seems to be based on the script in the Wiki which I wrote. What I am trying to do is build the Maximizer functionality into my AHK script so I don't *need* to run Maximizer at all but achieve the same effect directly through the AHK script.

    My current script also doesn't care about who is main and who is not. I have two broadcast methods, one of them will broadcast to all sessions, the other will only broadcast to the non-active sessions. In other words, I didn't care who the current main was.

    However, what you are trying to do and what I am working on requires knowledge of which WoW session is the main and which are clones. The script also needs to keep track of which clone is which if you want it to affect your formations or moving/sizing of individual windows and switching mains. Even re-launching a specific session requires knowledge of which session is which. You are relying on the order of the IDs retrieved by WinGet and you are welcome to. I merely presented an alternative that does not rely on WinGet. Removing dependancies is a good thing.

    The code I am working on also stores everything in arrays. In other words, people who two-box, three-box, four-box and five-box can all use the same script. They just need to edit the script header. No need to go into the broadcasting methods and modify those as they will just loop through the array essentially removing code duplication.

    -

    Keeping track of IDs:

    If you are using the order of WowWinId and you want to shift the order then the following method should work:

    Code:
    ShiftWoWIDs(ShiftAmount)
    {
        ; WoWWinId is the list of IDs that will be shifted, ShiftAmount is the amount to shift the IDs by
        ; assumes 5 wow sessions
        global WoWWinId1
        global WoWWinId2
        global WoWWinId3
        global WoWWinId4
        global WoWWinId5
    
        ; shift WoWWinId1 by ShiftAmount
        Index := Mod(ShiftAmount, 5) + 1
        TempID%Index% := WoWWinId1
    
        ; shift WoWWinId2 by ShiftAmount
        Index := Mod(1 + ShiftAmount, 5) + 1
        TempID%Index% := WoWWinId2
    
        ; shift WoWWinId3 by ShiftAmount
        Index := Mod(2 + ShiftAmount, 5) + 1
        TempID%Index% := WoWWinId3
    
        ; shift WoWWinId4 by ShiftAmount
        Index := Mod(3 + ShiftAmount, 5) + 1
        TempID%Index% := WoWWinId4
    
        ; shift WoWWinId5 by ShiftAmount
        Index := Mod(4 + ShiftAmount, 5) + 1
        TempID%Index% := WoWWinId5
    
        ; now assign all the TempIDs back to the WoWWinIds
        WowWinId1 := TempID1
        WowWinId2 := TempID2
        WowWinId3 := TempID3
        WowWinId4 := TempID4
        WowWinId5 := TempID5
    }
    So to shift by 2 you just call ShiftWoWIDs(2). I've tested it and it seems to work.
    The Orcks of War
    Shaman Borck Zorck Dorck Porck Corck
    Mixed Team - Msblonde - Mswhite - Msblack - Msred - Msbrown -

Similar Threads

  1. bartender 4 button id's?
    By Jubber in forum Macros and Addons
    Replies: 3
    Last Post: 06-18-2009, 11:39 AM
  2. BUG - Losing a window and/or window freeze's
    By Ualaa in forum Software Tools
    Replies: 1
    Last Post: 10-27-2008, 08:18 AM
  3. Replies: 2
    Last Post: 07-05-2008, 03:16 PM
  4. Keyclone - Switch Main window with Slave Window
    By Dinnie in forum New Multi-Boxers & Support
    Replies: 3
    Last Post: 07-03-2008, 11:09 AM
  5. Moused over Window Becomes Target Window?
    By Silly Gooooose in forum Software Tools
    Replies: 5
    Last Post: 03-12-2008, 03:43 PM

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •