I manually launch all of my WoW instances then run the PowerShell script below. It has to be run as admin because it sorts the process IDs by exe path, which requires admin privileges.
Code:
function Join-String([string[]] $strArray, [string] $sep = ' ')
{
if ($strArray -ne $null) { [string]::Join($sep, $strArray) } else { $null }
}
# Get Window IDs
$pids = @(get-process -name $processName | sort Path | foreach { $_.Id })
$pids
$pidStr = join-string $pids ','
.\Wow.ahk $pidStr
My AHK script then does this:
Code:
; Get WoW process IDs from input params
pidStr = %1%
nPids = 0
Loop, parse, pidStr, `,
{
++nPids
pid%nPids% := A_LoopField
}
; Create a window group containing all WoW instances
Loop, %nPids%
{
localPid := pid%A_Index%
GroupAdd, wowGroup, ahk_pid %localPid%
}
Since I know which pid is my main WoW window and which one is each clone I can send keystrokes to specific toons without the clunkiness of creating separate keybindings on each. For normal keys that get sent to everyone I just do this:
Code:
; Send a string to everyone
SendAll(strKeys)
{
global nPids
Loop, %nPids%
{
SendWow(A_Index, strKeys)
}
}
~*1::SendAll("{1 down}{1 up}")
~*2::SendAll("{2 down}{2 up}")
~*3::SendAll("{3 down}{3 up}")
...
The "*" means that the key should be sent regardless of any modifiers. I pass control and alt as separate keys so that I can switch Bongos pages:
Code:
~Control::SendAll("{Control down}")
~Control Up::SendAll("{Control up}")
~Alt::SendAll("{Alt down}")
~Alt Up::SendAll("{Alt up}")
Connect With Us