Adding this autocomplete function from 'polyethene' makes the GUI champion/position selection so much faster.
http://www.autohotke...boxes/?p=125936
Run me through this, dont get what its doing.. he says something about if you dont like globals ![:/](//www.autohotkey.com/board/public/style_emoticons/default/unsure.png)
What he meant was to use auto-complete to fill in the combobox. This makes selecting the champion very quick.
Also the script needs to be run as an administrator to work (atleast for me).
So I modded the above code to make it run as administrator and auto-complete the boxes. [Selects champion first, then lane/role]
Here's the code-
;League of Legends AHK AutoPicker
;How it works:
;Pick hero you want to be automatically selected for you once you join a game.
;Make sure you own that hero or it resides here http://euw.leagueoflegends.com/news/champion-rotation
;Click 'OK'
;Popup Messagebox will appear to verify which hero you picked.
;Look for game, join game, as you normally would.
;Once at hero selection phase the program will type the hero name you selected and pick it.
;It will continue to try to pick it until it finds a gray color where the hero icon is suppose to be.
;If at anytime you want to close the program simply press F8.
Loop, %0% ; For each parameter:
{
param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
params .= A_Space . param
}
ShellExecute := A_IsUnicode ? "shell32\ShellExecute":"shell32\ShellExecuteA"
if not A_IsAdmin
{
If A_IsCompiled
DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_ScriptFullPath, str, params , str, A_WorkingDir, int, 1)
Else
DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_AhkPath, str, """" . A_ScriptFullPath . """" . A_Space . params, str, A_WorkingDir, int, 1)
ExitApp
}
#SingleInstance force
myGui("x860 y400", "LoLChampionSelector")
myGui(position, title)
{
global thatVar
global thisVar
gui, new
gui, Default
;gui, Color, 00ABA9
gui, +LastFound +LabelMyGui
gui, add, groupbox, w200 h120, LoLChampionSelector
gui, font, s8, Arial
gui, add, text, xm12 ym20 section,
gui, add, text, yp+17.5 center, Choose The Hero You Want
gui, Add, ComboBox, vthisVar w120 r10 gAC, |Ahri|Akali|Alistar|Amumu|Anivia|Annie|Ashe|Blitzcrank|Brand|Caitlyn|Cassiopeia|Cho'Gath|Corki|Darius|Diana|Dr. Mundo|Draven
|Elise|Evelynn|Ezreal|Fiddlesticks|Fiora|Fizz|Galio|Gangplank|Garen|Gragas|Graves|Hecarim|Heimerdinger|Irelia|Janna|Jarvan IV|Jax|Jayce
|Karma|Karthus|Kassadin|Katarina|Kayle|Kennen|Kha'Zix|Kog'Maw|LeBlanc|Lee|Leona|Lulu|Lux Mage|Malphite|Malzahar|Maokai|Master Yi|Miss Fortune|Mordekaiser|Morgana
|Nami|Nasus|Nautilus|Nidalee|Nocturne|Nunu|Olaf|Orianna|Pantheon|Poppy|Quinn and Valor|Rammus|Renekton|Rengar|Riven|Rumble|Ryze
|Sejuani|Shaco|Shen|Shyvana|Singed|Sion|Sivir|Skarner|Sona|Soraka|Swain|Syndra|Talon|Taric|Teemo|Thresh|Tristana|Trundle|Tryndamere|Twisted Fate|Twitch
|Udyr|Urgot|Varus|Vayne|Veigar|Vi|Viktor|Vladimir|Volibear|Warwick|Wukong|Xerath|Xin Zhao|Yasuo|Yorick|Zed|Ziggs|Zilean|Zyra
gui, Add, ComboBox, vthatVar w120 r10 gAC, |adc|tank|support|top|jungle|btm|mid
gui, add, button, yp+50 gDone, OK
gui, add, button, xp+50 gmyguiclose, Cancel
gui, add, text, yp+40 xp-45, Press F8 to Close
gui, add, text, yp+15, Modded by vsdgniuz
gui, add, link, yp+15, <a href="http://euw.leagueoflegends.com/news/champion-rotation">Click here to see Champion Rotation.</a>
gui, font, s10, Verdana
gui, add, text, yp+15 xp+3, Version: 1.5k
gui, show, % position, % title
return
AC:
AutoComplete(A_GuiControl)
Return
Done:
{
gui,submit,nohide
gui, destroy
msgbox Hero that will automatically be picked : %thisVar%
msgbox Position that will be automaticly called: %thatVar%
Loop
{
WinWaitActive ahk_class ApolloRuntimeContentWindow
{
PixelSearch, FoundaX, FoundaY, 912, 130, 996, 142, 0xFFFFFF, 0, Fast ;Find Search Box
if ErrorLevel = 0
{
MouseClick, left, 930, 135
Sleep 10
Send, %thisVar%
Sleep, 280
MouseClick, Left, 325, 212
Sleep 30
MouseClick, left, 355, 737
Sleep 10
Send, %thatVar%
Sleep 10
MouseClick, left, 922, 735
Sleep, 2000
}
PixelSearch, FoundbX, FoundbY, 296, 180, 350, 233, 0x303030, 0, Fast ;Pick Hero
if ErrorLevel = 0
{
ExitApp
}
}
}
return
}
myguiclose:
{
ExitApp
return
}
}
AutoComplete(ctrl)
{
static lf = "`n"
If GetKeyState("Delete") or GetKeyState("Backspace")
Return
SetControlDelay, -1
SetWinDelay, -1
GuiControlGet, h, Hwnd, %ctrl%
ControlGet, haystack, List, , , ahk_id %h%
GuiControlGet, needle, , %ctrl%
StringMid, text, haystack, pos := InStr(lf . haystack, lf . needle)
, InStr(haystack . lf, lf, false, pos) - pos
If text !=
{
if pos != 0
{
ControlSetText, , %text%, ahk_id %h%
ControlSend, , % "{Right " . StrLen(needle) . "}+^{End}", ahk_id %h%
}
}
}
F8::ExitApp
PS: I am extremely new to autohotkey (or any sort of programming for that matter) and I just joined few existing codes, nothing more. Code is Tested and Working.