suspend SetKeyDelay -1, -1 enterPressed := 0 autocastActive := 1 invokerActive := 0 themeNameString = nosound,male,female,soft,windows,irc soundTheme := 0 positionStr := 6,7,9,10,11,12 StringSplit, themeNames, themeNameString, `, debug := 0 RegRead, customKeyPath, HKEY_CURRENT_USER, Software\Blizzard Entertainment\Warcraft III, InstallPath if(StrLen(customKeyPath) = 0) { RegRead, customKeyPath, HKEY_CURRENT_USER, Software\Blizzard Entertainment\Warcraft III, InstallPathDCG } initKeys() if(debug = 0) settimer, TimerTick, 5000 ;Read Extension keys from CustomKeys.txt initKeys() { global customKeyLocation = %customKeyPath%\CustomKeys.txt FileRead, temp ,%customKeyLocation% if(ErrorLevel) { MsgBox, 4 , , The script was unable to read the CustomKeys.txt. Would you like to browse the filesystem for the folder containing your Customkeys.txt now? IfMsgBox Yes { PromptForDirectory() } } Loop { FileReadLine, line, %customKeyLocation%, %A_Index% if(A_Index>50) { break } if(ErrorLevel) { MsgBox, Unable to read CustomKeys.txt return } IfInString, line, [itemmodifier] { StringReplace, ItemModifier, line, // [itemmodifier]=, , All } Items = 1,2,3,4,5,6 Loop, parse, Items, `, { CheckFor(line, ItemModifier, "item"A_LoopField, "items") } IfInString, line, [autocastmodifier] { StringReplace,AutocastModifier, line, // [autocastmodifier]=, , All } autocast = 6,7,9,10,11,12 Loop, parse, autocast, `, { CheckFor(line, AutocastModifier, "autocast"A_LoopField, "autocast") } IfInString, line, [invokermodifier] { StringReplace,InvokerModifier, line, // [invokermodifier]=, , All } invoker = 6,7 Loop, parse, invoker, `, { CheckFor(line, InvokerModifier, "invoker"A_LoopField, "invoker") } CheckFor(line, "", "activate", "activate") CheckFor(line, "", "deactivate", "deactivate") CheckFor(line, "", "toggleautocast", "toggleautocast") CheckFor(line, "", "toggleinvoker", "toggleinvoker") CheckFor(line, "", "focushero", "focushero") CheckFor(line, "", "entersync", "entersync") IfInString, line, [soundTheme] { StringReplace,soundTheme, line, // [soundTheme]=, , All } IfInString, line, [positions] { StringReplace, positionStr, line, // [positions]=, , All } IfInString, line, [debug] { StringReplace, debug, line, // [debug]=, , All } } ToggleKeys("items", "ON") ToggleKeys("rightclick", "ON") ToggleKeys("activate", "ON") ToggleKeys("deactivate", "ON") ToggleKeys("toggleautocast", "ON") ToggleKeys("toggleinvoker", "ON") ToggleKeys("focushero", "ON") ToggleKeys("entersync", "ON") InitSounds() StringSplit, positions, positionStr, `, } InitSounds() { global FileCreateDir, Sounds if(soundTheme = 1) { FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\male-autocast-active.mp3, %A_WorkingDir%\Sounds\male-autocast-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\male-autocast-disabled.mp3, %A_WorkingDir%\Sounds\male-autocast-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\male-invoker-active.mp3, %A_WorkingDir%\Sounds\male-invoker-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\male-invoker-disabled.mp3, %A_WorkingDir%\Sounds\male-invoker-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\male-script-active.mp3, %A_WorkingDir%\Sounds\male-script-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\male-script-disabled.mp3, %A_WorkingDir%\Sounds\male-script-disabled.mp3, 0 } if(soundTheme = 2) { FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\female-autocast-active.mp3, %A_WorkingDir%\Sounds\female-autocast-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\female-autocast-disabled.mp3, %A_WorkingDir%\Sounds\female-autocast-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\female-invoker-active.mp3, %A_WorkingDir%\Sounds\female-invoker-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\female-invoker-disabled.mp3, %A_WorkingDir%\Sounds\female-invoker-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\female-script-active.mp3, %A_WorkingDir%\Sounds\female-script-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\female-script-disabled.mp3, %A_WorkingDir%\Sounds\female-script-disabled.mp3, 0 } if(soundTheme = 3) { FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\soft-autocast-active.mp3, %A_WorkingDir%\Sounds\soft-autocast-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\soft-autocast-disabled.mp3, %A_WorkingDir%\Sounds\soft-autocast-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\soft-invoker-active.mp3, %A_WorkingDir%\Sounds\soft-invoker-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\soft-invoker-disabled.mp3, %A_WorkingDir%\Sounds\soft-invoker-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\soft-script-active.mp3, %A_WorkingDir%\Sounds\soft-script-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\soft-script-disabled.mp3, %A_WorkingDir%\Sounds\soft-script-disabled.mp3, 0 } if(soundTheme = 4) { FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\windows-autocast-active.mp3, %A_WorkingDir%\Sounds\windows-autocast-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\windows-autocast-disabled.mp3, %A_WorkingDir%\Sounds\windows-autocast-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\windows-invoker-active.mp3, %A_WorkingDir%\Sounds\windows-invoker-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\windows-invoker-disabled.mp3, %A_WorkingDir%\Sounds\windows-invoker-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\windows-script-active.mp3, %A_WorkingDir%\Sounds\windows-script-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\windows-script-disabled.mp3, %A_WorkingDir%\Sounds\windows-script-disabled.mp3, 0 } if(soundTheme = 5) { FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\irc-autocast-active.mp3, %A_WorkingDir%\Sounds\irc-autocast-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\irc-autocast-disabled.mp3, %A_WorkingDir%\Sounds\irc-autocast-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\irc-invoker-active.mp3, %A_WorkingDir%\Sounds\irc-invoker-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\irc-invoker-disabled.mp3, %A_WorkingDir%\Sounds\irc-invoker-disabled.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\irc-script-active.mp3, %A_WorkingDir%\Sounds\irc-script-active.mp3, 0 FileInstall C:\Games\Warcraft III\Autohotkey\Sounds\irc-script-disabled.mp3, %A_WorkingDir%\Sounds\irc-script-disabled.mp3, 0 } } CheckFor(line, modifier, action, label) { IfInString, line, [%action%] { StringReplace,hotkey, line, // [%action%]=, , All if(hotkey <> "#") { ;MsgBox, %modifier%-%hotkey%-%action% RegisterHotkey(modifier, hotkey, action, label) } } } ToggleKeys(category, state) { global Loop %HotkeyCounter% { if(category = CategoryArray%A_Index%) { key = % HotkeyArray%A_Index% label = % LabelArray%A_Index% Hotkey, $%key%, %label%, %state% } } } RegisterHotkey(modifier,key,label,category) { global combined = %modifier%%key% if(HotkeyCounter != 0) HotkeyCounter += 1 HotkeyArray%HotkeyCounter% := combined LabelArray%HotkeyCounter% := label CategoryArray%HotkeyCounter% := category ;MsgBox, %combined% %label% } InsideWarcraft() { global if(debug) return true ifWinActive, Warcraft III return true else return false } PlaySoundFile(file) { global index := soundTheme+1 theme := % themeNames%index% if(soundTheme <> 0) { ;MsgBox, Sounds\%theme%-%file% SoundPlay, Sounds\%theme%-%file% } } TurnOn(playsound) { if(A_IsSuspended==1) { if(playsound) PlaySoundFile("script-active.mp3") suspend } } TurnOff(playsound) { if(A_IsSuspended==0) { if(playsound) PlaySoundFile("script-disabled.mp3") suspend } } PromptForDirectory() { global FileSelectFolder, customKeyPath, , ,Please select the location of your Warcraft III Directory.`r`n`r`nExample: D:\Games\Warcraft III customKeyPath := RegExReplace(customKeyPath, "\\$") customKeyLocation = %customKeyPath%\CustomKeys.txt if(StrLen(customKeyPath) > 0) { RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\Blizzard Entertainment\Warcraft III, InstallPathDCG, %customKeyPath% } if(ErrorLevel) MsgBox, Error Writing to registry. Try running the program as administator } EnterAction() { global if(InsideWarcraft()) { if(enterPressed == 0) { enterPressed := 1 CapFix() } else { enterPressed := 0 } } } CapFix() { state := GetKeyState("Capslock", "T") if(state) SetCapsLockState, Off } TimerTick: if(A_IsSuspended==0) { ifWinNotActive, Warcraft III { TurnOff(1) } } return $Enter:: EnterAction() SendInput, {Enter} return $+Enter:: EnterAction() SendInput, +{Enter} return activate: Suspend, Permit if(InsideWarcraft()) { if(A_IsSuspended==1) { invokerActive = 0 ToggleKeys("invoker", "OFF") autocastActive = 1 ToggleKeys("autocast", "ON") enterPressed := 0 TurnOn(1) } } return deactivate: TurnOff(1) return toggleinvoker: if(invokerActive = 0) { invokerActive = 1 PlaySoundFile("invoker-active.mp3") ToggleKeys("invoker", "ON") } else { invokerActive = 0 PlaySoundFile("invoker-disabled.mp3") ToggleKeys("invoker", "OFF") } return toggleautocast: if(autocastActive = 0) { autocastActive = 1 PlaySoundFile("autocast-active.mp3") ToggleKeys("autocast", "ON") } else { autocastActive = 0 PlaySoundFile("autocast-disabled.mp3") ToggleKeys("autocast", "OFF") } return invoker6: ClickSkill(positions1, "left") return invoker7: ClickSkill(positions2, "left") return autocast6: ClickSkill(positions1, "right") return autocast7: ClickSkill(positions2, "right") return autocast9: ClickSkill(positions3, "right") return autocast10: ClickSkill(positions4, "right") return autocast11: ClickSkill(positions5, "right") return autocast12: ClickSkill(positions6, "right") return FakeNumpad(numpad) { global if(enterPressed = 0) SendInput, {%numpad%} else ResendOriginalKeyPress() } ResendOriginalKeyPress() { hotkey := RegExReplace(A_ThisHotkey, "[\$\*]", "") SendInput, {%hotkey%} } item1: FakeNumpad("Numpad7") return item2: FakeNumpad("Numpad8") return item3: FakeNumpad("Numpad4") return item4: FakeNumpad("Numpad5") return item5: FakeNumpad("Numpad1") return item6: FakeNumpad("Numpad2") return focushero: if(enterPressed = 0) { SendInput, {F1}{F1} } else ResendOriginalKeyPress() return entersync: if(enterPressed = 0) enterPressed := 1 else enterPressed := 0 return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; This function was developed by "Kitt" ;; Rightclick the n-th position of the skill grid and move mouse back to the original position ClickSkill(SkillSpot, type) { global if(enterPressed = 0) { if(SkillSpot <> none) { CoordMode, Mouse, Relative MouseGetPos,xMouse,yMouse WinGetPos,,,Width,Height,A xSpot := Mod(SkillSpot - 1, 4) ySpot := (SkillSpot - xSpot + 1)/4 Width := Width*(0.80 + xSpot*0.055) Height := Height*(0.78 + ySpot*0.07) MouseClick ,%type% , %Width%,%Height%, 1 , 0 MouseMove,xMouse,yMouse,0 } } else ResendOriginalKeyPress() }