Log in

View Full Version : Default autohotkey script doesn't work



luxlunae
08-05-2008, 06:24 AM
ClonesPush(strKeys)
{
global WowWinId1
global WowWinId2
global WowWinId3
global WowWinId4
global WowWinId5
IfWinNotActive, ahk_id %WowWinId1%
ControlSend, , %strKeys%, ahk_id %WowWinId1%
IfWinNotActive, ahk_id %WowWinId2%
ControlSend, , %strKeys%, ahk_id %WowWinId2%
IfWinNotActive, ahk_id %WowWinId3%
ControlSend, , %strKeys%, ahk_id %WowWinId3%
IfWinNotActive, ahk_id %WowWinId4%
ControlSend, , %strKeys%, ahk_id %WowWinId4%
IfWinNotActive, ahk_id %WowWinId5%
ControlSend, , %strKeys%, ahk_id %WowWinId5%
}

;Grab unique window ID's
WinGet, WowWinId, List, World of Warcraft

; *******************************
; *** Only if WoW is in focus ***
; *******************************
#IfWinActive, World of Warcraft

;*** Special Functions ***

; *** Makes clones follow main ***
^-::ClonesPush("{- down}{- up}")

; *** Makes clones assist main ***
^=::ClonesPush("{= down}{= up}")

; *** Makes clones jump with main ***
~Space::ClonesPush("{Space down}{Space up}")

; *** Suspends HotKeys while typing on main ***
~Enter::Suspend, Toggle
~/::Suspend, On
~Escape::Suspend, Off

; *******************
; *** Hotbars 1-0 ***
; *******************
~1::ClonesPush("{= down}{= up}{1 down}{1 up}")
~2::ClonesPush("{= down}{= up}{2 down}{2 up}")
~3::ClonesPush("{= down}{= up}{3 down}{3 up}")
~4::ClonesPush("{= down}{= up}{4 down}{4 up}")
~5::ClonesPush("{= down}{= up}{5 down}{5 up}")
~6::ClonesPush("{= down}{= up}{6 down}{6 up}")
~7::ClonesPush("{= down}{= up}{7 down}{7 up}")
~8::ClonesPush("{= down}{= up}{8 down}{8 up}")
~9::ClonesPush("{= down}{= up}{9 down}{9 up}")
~0::ClonesPush("{= down}{= up}{0 down}{0 up}")

; ***************************
; *** Hotbars SHIFT(+) 1-0 ***
; ***************************
~+1::ClonesPush("{Shift down}{1 down}{1 up}{Shift up}")
~+2::ClonesPush("{Shift down}{2 down}{2 up}{Shift up}")
~+3::ClonesPush("{Shift down}{3 down}{3 up}{Shift up}")
~+4::ClonesPush("{Shift down}{4 down}{4 up}{Shift up}")
~+5::ClonesPush("{Shift down}{5 down}{5 up}{Shift up}")
~+6::ClonesPush("{Shift down}{6 down}{6 up}{Shift up}")
~+7::ClonesPush("{Shift down}{7 down}{7 up}{Shift up}")
~+8::ClonesPush("{Shift down}{8 down}{8 up}{Shift up}")
~+9::ClonesPush("{Shift down}{9 down}{9 up}{Shift up}")
~+0::ClonesPush("{Shift down}{0 down}{0 up}{Shift up}")

; **************************
; *** Hotbars CTRL(^) 1-0 ***
; **************************
~^1::ClonesPush("{Ctrl down}{1 down}{1 up}{Ctrl up}")
~^2::ClonesPush("{Ctrl down}{2 down}{2 up}{Ctrl up}")
~^3::ClonesPush("{Ctrl down}{3 down}{3 up}{Ctrl up}")
~^4::ClonesPush("{Ctrl down}{4 down}{4 up}{Ctrl up}")
~^5::ClonesPush("{Ctrl down}{5 down}{5 up}{Ctrl up}")
~^6::ClonesPush("{Ctrl down}{6 down}{6 up}{Ctrl up}")
~^7::ClonesPush("{Ctrl down}{7 down}{7 up}{Ctrl up}")
~^8::ClonesPush("{Ctrl down}{8 down}{8 up}{Ctrl up}")
~^9::ClonesPush("{Ctrl down}{9 down}{9 up}{Ctrl up}")
~^0::ClonesPush("{Ctrl down}{0 down}{0 up}{Ctrl up}")

I tried to run this script and get the error

"Error at line 22
Line text: ^-::ClonesPush("{- down}{- up}")
Error hotkeys/hotstrings are not allowed inside functions.
This program will exit.
"

All I did was copy paste it from the wiki! (and I deleted the references to the last 3 wows, since I'll only be running it dual boxing)

Metalocalypse
08-05-2008, 09:33 AM
only thing I can think of is replacing the ^ with a ~

luxlunae
08-05-2008, 10:46 AM
Strangely when I recopy it and dont delete the other three window things it seems to work fine (wont know for sure until after maintenance)

Lokked
08-05-2008, 11:41 AM
^-::ClonesPush("{- down}{- up}")
and
^=::ClonesPush("{= down}{= up}")

Should not have the ^ in the front. ^ means - The CTRL key and the following key are pressed down to activate the Hotkey.
You do not want to have to press CTRL - or CTRL =, as this would require 2 hands to do something you will be doing a LOT.

Aside from that, I believe you accidentally deleted the end } after the ClonesPush definition. Copy and Past this script:


ClonesPush(strKeys)
{
global WowWinId1
global WowWinId2
IfWinNotActive, ahk_id %WowWinId1%
ControlSend, , %strKeys%, ahk_id %WowWinId1%
IfWinNotActive, ahk_id %WowWinId2%
ControlSend, , %strKeys%, ahk_id %WowWinId2%
}

WinGet, WowWinId, List, World of Warcraft

#IfWinActive, World of Warcraft
-::ClonesPush("{- down}{- up}")
=::ClonesPush("{= down}{= up}")
~Space::ClonesPush("{Space down}{Space up}")
~Enter:uspend, Toggle
~/:uspend, On
~Escape:uspend, Off
~1::ClonesPush("{= down}{= up}{1 down}{1 up}")
~2::ClonesPush("{= down}{= up}{2 down}{2 up}")
~3::ClonesPush("{= down}{= up}{3 down}{3 up}")
~4::ClonesPush("{= down}{= up}{4 down}{4 up}")
~5::ClonesPush("{= down}{= up}{5 down}{5 up}")
~6::ClonesPush("{= down}{= up}{6 down}{6 up}")
~7::ClonesPush("{= down}{= up}{7 down}{7 up}")
~8::ClonesPush("{= down}{= up}{8 down}{8 up}")
~9::ClonesPush("{= down}{= up}{9 down}{9 up}")
~0::ClonesPush("{= down}{= up}{0 down}{0 up}")
~+1::ClonesPush("{Shift down}{1 down}{1 up}{Shift up}")
~+2::ClonesPush("{Shift down}{2 down}{2 up}{Shift up}")
~+3::ClonesPush("{Shift down}{3 down}{3 up}{Shift up}")
~+4::ClonesPush("{Shift down}{4 down}{4 up}{Shift up}")
~+5::ClonesPush("{Shift down}{5 down}{5 up}{Shift up}")
~+6::ClonesPush("{Shift down}{6 down}{6 up}{Shift up}")
~+7::ClonesPush("{Shift down}{7 down}{7 up}{Shift up}")
~+8::ClonesPush("{Shift down}{8 down}{8 up}{Shift up}")
~+9::ClonesPush("{Shift down}{9 down}{9 up}{Shift up}")
~+0::ClonesPush("{Shift down}{0 down}{0 up}{Shift up}")
~^1::ClonesPush("{Ctrl down}{1 down}{1 up}{Ctrl up}")
~^2::ClonesPush("{Ctrl down}{2 down}{2 up}{Ctrl up}")
~^3::ClonesPush("{Ctrl down}{3 down}{3 up}{Ctrl up}")
~^4::ClonesPush("{Ctrl down}{4 down}{4 up}{Ctrl up}")
~^5::ClonesPush("{Ctrl down}{5 down}{5 up}{Ctrl up}")
~^6::ClonesPush("{Ctrl down}{6 down}{6 up}{Ctrl up}")
~^7::ClonesPush("{Ctrl down}{7 down}{7 up}{Ctrl up}")
~^8::ClonesPush("{Ctrl down}{8 down}{8 up}{Ctrl up}")
~^9::ClonesPush("{Ctrl down}{9 down}{9 up}{Ctrl up}")
~^0::ClonesPush("{Ctrl down}{0 down}{0 up}{Ctrl up}")


Make your /follow focus macro on the - button, and your /assist focus macro on the = button.

Daki
08-08-2008, 01:51 AM
SplashTextOn, 325, , Preparing to find your Main and Clone windows of WoW.
Sleep, 2000
SplasHtextoff

WinGet, wowid, List, World of Warcraft

WinMinimize, ahk_id %wowid1%
WinMinimize, ahk_id %wowid2%
WinMinimize, ahk_id %wowid3%

WinActivate, ahk_id %wowid1%

MsgBox, 4,, Is this your WOW Main window? (press Yes or No)
IfMsgBox Yes
idMain = %wowid1%
else
MsgBox, 4,, Is THIS your WOW Main window? (press Yes or No)
IfMsgBox Yes
idMain = %wowid2%
else
idMain = %wowid3%

If idMain = %wowid1%
{
idClone = %wowid2%
idClone2 = %wowid3%
} else {
If idMain = %wowid2%
{
idClone = %wowid1%
idClone2 = %wowid3%
} else{
idClone = %wowid1%
idClone2 = %wowid2%
}
}

WinActivate, ahk_id %idMain%
WinActivate, ahk_id %idClone%
WinActivate, ahk_id %idClone2%

; *******************
; *** Hotbars 1-0 ***
; *******************
#IfWinActive, World of Warcraft
~1::
ControlSend,,{1 down}{1 up}, ahk_id %idMain%
ControlSend,,{1 down}{1 up}, ahk_id %idClone%
ControlSend,,{1 down}{1 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~2::
ControlSend,,{2 down}{2 up}, ahk_id %idMain%
ControlSend,,{2 down}{2 up}, ahk_id %idClone%
ControlSend,,{2 down}{2 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~3::
ControlSend,,{3 down}{3 up}, ahk_id %idMain%
ControlSend,,{3 down}{3 up}, ahk_id %idClone%
ControlSend,,{3 down}{3 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~4::
ControlSend,,{4 down}{4 up}, ahk_id %idMain%
ControlSend,,{4 down}{4 up}, ahk_id %idClone%
ControlSend,,{4 down}{4 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~5::
ControlSend,,{5 down}{5 up}, ahk_id %idMain%
ControlSend,,{5 down}{5 up}, ahk_id %idClone%
ControlSend,,{5 down}{5 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~6::
ControlSend,,{6 down}{6 up}, ahk_id %idMain%
ControlSend,,{6 down}{6 up}, ahk_id %idClone%
ControlSend,,{6 down}{6 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~7::
ControlSend,,{7 down}{7 up}, ahk_id %idMain%
ControlSend,,{7 down}{7 up}, ahk_id %idClone%
ControlSend,,{7 down}{7 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~8::
ControlSend,,{8 down}{8 up}, ahk_id %idMain%
ControlSend,,{8 down}{8 up}, ahk_id %idClone%
ControlSend,,{8 down}{8 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~9::
ControlSend,,{9 down}{9 up}, ahk_id %idMain%
ControlSend,,{9 down}{9 up}, ahk_id %idClone%
ControlSend,,{9 down}{9 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~0::
ControlSend,,{0 down}{0 up}, ahk_id %idMain%
ControlSend,,{0 down}{0 up}, ahk_id %idClone%
ControlSend,,{0 down}{0 up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~-::
ControlSend,,{- down}{- up}, ahk_id %idMain%
ControlSend,,{- down}{- up}, ahk_id %idClone%
ControlSend,,{- down}{- up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~=::
ControlSend,,{= down}{= up}, ahk_id %idMain%
ControlSend,,{= down}{= up}, ahk_id %idClone%
ControlSend,,{= down}{= up}, ahk_id %idClone2%
return



; ***************************
; *** MOVEMENT ***
; ***************************

#IfWinActive, World of Warcraft
~space::
ControlSend,,{space down}{space up}, ahk_id %idMain%
ControlSend,,{space down}{space up}, ahk_id %idClone%
ControlSend,,{space down}{space up}, ahk_id %idClone2%
return

; ***************************
; *** Hotbars Shift ^ 1-0 ***
; ***************************
#IfWinActive, World of Warcraft
~+1::
ControlSend,,{Shift down}{1 down}{1 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{1 down}{1 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{1 down}{1 up}{Shift up}, ahk_id %idClone%
return

#IfWinActive, World of Warcraft
~+2::
ControlSend,,{Shift down}{2 down}{2 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{2 down}{2 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{2 down}{2 up}{Shift up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~+3::
ControlSend,,{Shift down}{3 down}{3 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{3 down}{3 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{3 down}{3 up}{Shift up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~+4::
ControlSend,,{Shift down}{4 down}{4 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{4 down}{4 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{4 down}{4 up}{Shift up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~+5::
ControlSend,,{Shift down}{5 down}{5 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{5 down}{5 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{5 down}{5 up}{Shift up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~+6::
ControlSend,,{Shift down}{6 down}{6 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{6 down}{6 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{6 down}{6 up}{Shift up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~+7::
ControlSend,,{Shift down}{7 down}{7 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{7 down}{7 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{7 down}{7 up}{Shift up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~+8::
ControlSend,,{Shift down}{8 down}{8 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{8 down}{8 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{8 down}{8 up}{Shift up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~+9::
ControlSend,,{Shift down}{9 down}{9 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{9 down}{9 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{9 down}{9 up}{Shift up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~+0::
ControlSend,,{Shift down}{0 down}{0 up}{Shift up}, ahk_id %idMain%
ControlSend,,{Shift down}{0 down}{0 up}{Shift up}, ahk_id %idClone%
ControlSend,,{Shift down}{0 down}{0 up}{Shift up}, ahk_id %idClone2%
return

; **************************
; *** Hotbars Cntl ^ 1-0 ***
; **************************
#IfWinActive, World of Warcraft
~^1::
ControlSend,,{Ctrl down}{1 down}{1 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{1 down}{1 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{1 down}{1 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^2::
ControlSend,,{Ctrl down}{2 down}{2 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{2 down}{2 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{2 down}{2 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^3::
ControlSend,,{Ctrl down}{3 down}{3 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{3 down}{3 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{3 down}{3 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^4::
ControlSend,,{Ctrl down}{4 down}{4 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{4 down}{4 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{4 down}{4 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^5::
ControlSend,,{Ctrl down}{5 down}{5 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{5 down}{5 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{5 down}{5 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^6::
ControlSend,,{Ctrl down}{6 down}{6 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{6 down}{6 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{6 down}{6 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^7::
ControlSend,,{Ctrl down}{7 down}{7 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{7 down}{7 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{7 down}{7 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^8::
ControlSend,,{Ctrl down}{8 down}{8 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{8 down}{8 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{8 down}{8 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^9::
ControlSend,,{Ctrl down}{9 down}{9 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{9 down}{9 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{9 down}{9 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^0::
ControlSend,,{Ctrl down}{0 down}{0 up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{0 down}{0 up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{0 down}{0 up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^-::
ControlSend,,{Ctrl down}{- down}{- up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{- down}{- up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{- down}{- up}{Ctrl up}, ahk_id %idClone2%
return

#IfWinActive, World of Warcraft
~^=::
ControlSend,,{Ctrl down}{= down}{= up}{Ctrl up}, ahk_id %idMain%
ControlSend,,{Ctrl down}{= down}{= up}{Ctrl up}, ahk_id %idClone%
ControlSend,,{Ctrl down}{= down}{= up}{Ctrl up}, ahk_id %idClone2%
return


;**FORMATION**

#IfWinActive, World of Warcraft
End::
ControlSend,,{s down}, ahk_id %wowid1%
ControlSend,,{e down}, ahk_id %wowid2%
ControlSend,,{q down}, ahk_id %wowid3%
KeyWait End
ControlSend,,{s up}, ahk_id %wowid1%
ControlSend,,{e up}, ahk_id %wowid2%
ControlSend,,{q up}, ahk_id %wowid3%
return

is what I use... =D ' - ' doesnt seem to want to work right now either... still working with it... other than that... it works fine. I think the ' - ' doesnt work in AHK... but anyhow... Formation is:

x

xx

to

xxx