Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetTitleMatchMode, 1
- Global masterKeyList := ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e", "f", "g", "h"
- , "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
- , "{Numpad1}", "{Numpad3}", "{Numpad9}", "{Numpad0}", "{NumpadMult}", "{NumpadDot}", "{Insert}", "{Delete}"
- , "{Home}", "{End}", "{Space}", "{Esc}", "{F1}", "{F2}", "{F3}", "{F4}", "{F5}", "{F6}"
- , "[", "]", ";", "'", ",", ".", "-", "=", "{Tab}"]
- Global totalCheckboxes := masterKeyList.MaxIndex()
- Global registrySettingsLocation := "HKEY_CURRENT_USER\Software\AOAC-Settings"
- Global guiBuilt = 0
- Global scriptPaused = 0
- ; Gather info on settings
- RegRead, mainCharReg, %registrySettingsLocation%, mainChar
- if ErrorLevel {
- RegWrite, REG_SZ, %registrySettingsLocation%, mainChar, No Data
- mainCharReg = No Data
- }
- RegRead, aoScriptsLocationReg, %registrySettingsLocation%, aoScriptsLocation
- if ErrorLevel {
- RegWrite, REG_SZ, %registrySettingsLocation%, aoScriptsLocation, No Data
- aoScriptsLocationReg = No Data
- }
- RegRead, varFollowKey, %registrySettingsLocation%, followKey
- RegRead, varFollowStop, %registrySettingsLocation%, followStop
- for each,obj in masterKeyList {
- RegRead, checkboxKey%each%Reg, %registrySettingsLocation%, checkboxKey%each%
- If ErrorLevel
- RegWrite, REG_DWORD, %registrySettingsLocation%, checkboxKey%each%, 0
- }
- ; main loop
- loop {
- if !guiBuilt
- GoSub BuildGUI
- if scriptPaused
- continue
- }
- BuildGUI:
- Gui, Add, Edit, x12 y9 w110 h20 vmainChar,
- Gui, Add, Text, x122 y9 w180 h20 , <- Character to assist (Main Window)
- Gui, Add, CheckBox, x12 y69 w35 h20 vcheckboxKey1, - 1
- Gui, Add, CheckBox, x12 y89 w35 h20 vcheckboxKey2, - 2
- Gui, Add, CheckBox, x12 y109 w35 h20 vcheckboxKey3, - 3
- Gui, Add, CheckBox, x12 y129 w35 h20 vcheckboxKey4, - 4
- Gui, Add, CheckBox, x12 y149 w35 h20 vcheckboxKey5, - 5
- Gui, Add, CheckBox, x12 y169 w35 h20 vcheckboxKey6, - 6
- Gui, Add, CheckBox, x12 y189 w35 h20 vcheckboxKey7, - 7
- Gui, Add, CheckBox, x12 y209 w35 h20 vcheckboxKey8, - 8
- Gui, Add, CheckBox, x12 y229 w35 h20 vcheckboxKey9, - 9
- Gui, Add, CheckBox, x12 y249 w35 h20 vcheckboxKey10, - 0
- Gui, Add, CheckBox, x60 y69 w35 h20 vcheckboxKey11, - A
- Gui, Add, CheckBox, x60 y89 w35 h20 vcheckboxKey12, - B
- Gui, Add, CheckBox, x60 y109 w35 h20 vcheckboxKey13, - C
- Gui, Add, CheckBox, x60 y129 w35 h20 vcheckboxKey14, - D
- Gui, Add, CheckBox, x60 y149 w35 h20 vcheckboxKey15, - E
- Gui, Add, CheckBox, x60 y169 w35 h20 vcheckboxKey16, - F
- Gui, Add, CheckBox, x60 y189 w35 h20 vcheckboxKey17, - G
- Gui, Add, CheckBox, x60 y209 w35 h20 vcheckboxKey18, - H
- Gui, Add, CheckBox, x60 y229 w35 h20 vcheckboxKey19, - I
- Gui, Add, CheckBox, x60 y249 w35 h20 vcheckboxKey20, - J
- Gui, Add, CheckBox, x108 y69 w35 h20 vcheckboxKey21, - K
- Gui, Add, CheckBox, x108 y89 w35 h20 vcheckboxKey22, - L
- Gui, Add, CheckBox, x108 y109 w35 h20 vcheckboxKey23, - M
- Gui, Add, CheckBox, x108 y129 w35 h20 vcheckboxKey24, - N
- Gui, Add, CheckBox, x108 y149 w35 h20 vcheckboxKey25, - O
- Gui, Add, CheckBox, x108 y169 w35 h20 vcheckboxKey26, - P
- Gui, Add, CheckBox, x108 y189 w35 h20 vcheckboxKey27, - Q
- Gui, Add, CheckBox, x108 y209 w35 h20 vcheckboxKey28, - R
- Gui, Add, CheckBox, x108 y229 w35 h20 vcheckboxKey29, - S
- Gui, Add, CheckBox, x108 y249 w35 h20 vcheckboxKey30, - T
- Gui, Add, CheckBox, x156 y69 w35 h20 vcheckboxKey31, - U
- Gui, Add, CheckBox, x156 y89 w35 h20 vcheckboxKey32, - V
- Gui, Add, CheckBox, x156 y109 w35 h20 vcheckboxKey33, - W
- Gui, Add, CheckBox, x156 y129 w35 h20 vcheckboxKey34, - X
- Gui, Add, CheckBox, x156 y149 w35 h20 vcheckboxKey35, - Y
- Gui, Add, CheckBox, x156 y169 w35 h20 vcheckboxKey36, - Z
- Gui, Add, CheckBox, x204 y69 w70 h20 vcheckboxKey37, Numpad 1
- Gui, Add, CheckBox, x204 y89 w70 h20 vcheckboxKey38, Numpad 3
- Gui, Add, CheckBox, x204 y109 w70 h20 vcheckboxKey39, Numpad 9
- Gui, Add, CheckBox, x204 y129 w70 h20 vcheckboxKey40, Numpad 0
- Gui, Add, CheckBox, x204 y149 w70 h20 vcheckboxKey41, Numpad *
- Gui, Add, CheckBox, x204 y169 w70 h20 vcheckboxKey42, Numpad .
- Gui, Add, CheckBox, x204 y189 w70 h20 vcheckboxKey43, Insert
- Gui, Add, CheckBox, x204 y209 w70 h20 vcheckboxKey44, Delete
- Gui, Add, CheckBox, x204 y229 w70 h20 vcheckboxKey45, Home
- Gui, Add, CheckBox, x204 y249 w70 h20 vcheckboxKey46, End
- Gui, Add, CheckBox, x285 y69 w70 h20 vcheckboxKey47, Space bar
- Gui, Add, CheckBox, x285 y89 w70 h20 vcheckboxKey48, Escape
- Gui, Add, CheckBox, x285 y109 w35 h20 vcheckboxKey49, - F1
- Gui, Add, CheckBox, x285 y129 w35 h20 vcheckboxKey50, - F2
- Gui, Add, CheckBox, x285 y149 w35 h20 vcheckboxKey51, - F3
- Gui, Add, CheckBox, x285 y169 w35 h20 vcheckboxKey52, - F4
- Gui, Add, CheckBox, x285 y189 w35 h20 vcheckboxKey53, - F5
- Gui, Add, CheckBox, x285 y209 w35 h20 vcheckboxKey54, - F6
- Gui, Add, CheckBox, x365 y69 w35 h20 vcheckboxKey55, - [
- Gui, Add, CheckBox, x365 y89 w35 h20 vcheckboxKey56, - ]
- Gui, Add, CheckBox, x365 y109 w35 h20 vcheckboxKey57, - `;
- Gui, Add, CheckBox, x365 y129 w35 h20 vcheckboxKey58, - '
- Gui, Add, CheckBox, x365 y149 w35 h20 vcheckboxKey59, - ,
- Gui, Add, CheckBox, x365 y169 w35 h20 vcheckboxKey60, - .
- Gui, Add, CheckBox, x365 y189 w35 h20 vcheckboxKey61, - -
- Gui, Add, CheckBox, x365 y209 w35 h20 vcheckboxKey62, - =
- Gui, Add, CheckBox, x365 y229 w70 h20 vcheckboxKey63, - Tab
- Gui, Add, CheckBox, x502 y159 w100 h30 vch1 gCheckAll, Select All
- Gui, Add, CheckBox, x502 y189 w100 h30 vch2 gUnCheckAll, De-Select All
- Gui, Add, Button, x502 y109 w100 h30 gSaveAsDefault, Save As Default
- Gui, Add, Button, x502 y69 w100 h30 gActivateKeys, Activate Selected
- Gui, Add, Edit, x12 y39 w470 h20 vaoScriptsLocation,
- Gui, Add, Button, x502 y29 w100 h30 gBrowseAOFolder, Browse to AO Scripts
- Gui, Add, Text, x482 y39 w20 h20 , <----
- Gui, Add, Button, x15 y300 w50 h20 gHelpButton, Help
- Gui, Add, DropDownList, x110 y300 w95 h250 vfollowKey,
- Gui, Add, Text, x205 y300 w180 h20, <- Follow (must be checked above)
- Gui, Add, DropDownList, x110 y330 w95 h250 vfollowStop,
- Gui, Add, Text, x205 y330 w200 h20, <- Stop Follow (must be checked above)
- Gui, Add, Text, x480 y300 w130 h40 vpauseResumeTextBox,
- Gui, Add, Button, x502 y250 w100 h30 gPauseHotkeys, Toggle On/Off
- Gui, Show, x127 y87 h375 w624, AOAC - AO Alt Controller 1.0d
- ; Set initial values if first time running
- if !guiBuilt {
- GuiControl,,aoScriptsLocation, %aoScriptsLocationReg%
- GuiControl,,mainChar, %mainCharReg%
- for each,obj in masterKeyList {
- s := checkboxKey%each%Reg
- GuiControl,,checkboxKey%each%, %s%
- }
- s := ""
- for each,obj in masterKeyList {
- s .= "|" . obj
- if (obj = varFollowKey) {
- s .= "|"
- if (each = masterKeyList.MaxIndex()) ; add another if at the end
- s .= "|"
- }
- }
- GuiControl,,followKey, %s%
- s := ""
- for each,obj in masterKeyList {
- s .= "|" . obj
- if (obj = varFollowStop) {
- s .= "|"
- if (each = masterKeyList.MaxIndex()) ; add another if at the end
- s .= "|"
- }
- }
- GuiControl,,followStop, %s%
- ; turn off all hotkeys until activated
- for each,obj in masterKeyList {
- tempKey := StrReplace(StrReplace(obj, "{"), "}")
- Hotkey, %tempKey%, Off
- }
- }
- guiBuilt = 1
- Return
- BrowseAOFolder:
- EnvGet, tempFolder, LOCALAPPDATA
- FileSelectFolder, aoScriptsLocation, *%tempFolder%
- GuiControl,,aoScriptsLocation, %aoScriptsLocation%
- Return
- CheckAll:
- Loop, %totalCheckboxes%
- GuiControl,,checkboxKey%A_Index%, 1
- GuiControl,,ch1, 0
- Return
- UnCheckAll:
- Loop, %totalCheckboxes%
- GuiControl,,checkboxKey%A_Index%, 0
- GuiControl,,ch2, 0
- Return
- SaveAsDefault:
- ProcessGUI()
- GuiControlGet, tempMainChar,,mainChar
- GuiControlGet, tempScriptsLocation,,aoScriptsLocation
- GuiControlGet, tempFollowKey,,followKey
- GuiControlGet, tempFollowStop,,followStop
- RegWrite, REG_SZ, %registrySettingsLocation%, mainChar, %tempMainChar%
- RegWrite, REG_SZ, %registrySettingsLocation%, aoScriptsLocation, %tempScriptsLocation%
- RegWrite, REG_SZ, %registrySettingsLocation%, followKey, %tempFollowKey%
- RegWrite, REG_SZ, %registrySettingsLocation%, followStop, %tempFollowStop%
- for each,obj in masterKeyList {
- GuiControlGet, tempCheckBox,,checkboxKey%each%
- RegWrite, REG_DWORD, %registrySettingsLocation%, checkboxKey%each%, %tempCheckBox%
- }
- Return
- ActivateKeys:
- Gui, Submit, NoHide
- scriptPaused = 1
- GoSub PauseHotKeys ; updates the screen to show running
- ProcessGUI()
- Return
- PauseHotkeys:
- if scriptPaused {
- scriptPaused = 0
- Gui, Font, s18 cGreen Bold, Verdana
- GuiControl,Font,pauseResumeTextBox,
- GuiControl,,pauseResumeTextBox, RUNNING
- Gui, Font,,
- }
- else {
- scriptPaused = 1
- Gui, Font, s18 cRed Bold, Verdana
- GuiControl,Font,pauseResumeTextBox,
- GuiControl,,pauseResumeTextBox, PAUSED
- Gui, Font,,
- }
- ProcessGUI()
- Return
- HelpButton:
- s := "INFO:`nCreate assist macro as /macro assist /ahkassist`n`n"
- s .= "Use the ~ key to pause as needed (or press the button) `n`n"
- s .= "The Scripts folder will look starting in the AppData folder, most likely just browse to Local\Funcom\Anarchy Online\<random>\Anarchy Online\Scripts `n`n"
- s .= "The follow keybind assumes the follow macro is in this place on all characters and will hit F2 then the /follow macro on all but the main character. The Stop Follow key will send ""s"" to all background windows briefly to walk backwards, breaking follow. If you have this key bound to something else then it won't work."
- MsgBox % s
- Return
- GuiClose:
- ExitApp
- ProcessGUI() {
- GuiControlGet, tempScriptsLocation,,aoScriptsLocation
- GuiControlGet, tempMainChar,,mainChar
- if (tempScriptsLocation = "") {
- s := "You must browse to the AO Scripts folder,`nusually found in c:\users\<username>\appdata\local"
- s .= "`nand browse through the Funcom folders until you find the scripts folder, otherwise`n"
- s .= "the assist macro will not work correctly."
- MsgBox % s
- Return
- }
- if (tempMainChar = "") {
- MsgBox You must fill out a main character name as this `ngets written to the assist script
- Return
- }
- for each,obj in masterKeyList {
- tempKey := StrReplace(StrReplace(obj, "{"), "}")
- if (checkboxKey%each% and !scriptPaused)
- Hotkey, %tempKey%, On
- else
- Hotkey, %tempKey%, Off
- }
- tempAssist := tempScriptsLocation . "\ahkassist"
- assistFile := FileOpen(tempAssist, "w")
- if !IsObject(assistFile)
- MsgBox % "There was a problem opening the script file at `n" assistFile
- else {
- s := "/assist " . tempMainChar
- assistFile.Write(s)
- assistFile.Close()
- }
- }
- SendToAO(keyCommand) {
- Global followKey
- Global followStop
- IfWinActive, Anarchy Online
- WinGet, id, list, Anarchy Online
- Loop, %id% {
- this_id := id%A_Index%
- IfWinActive, ahk_id %this_id%
- Continue ; bypass sending to active session, send to all others
- if (keyCommand = followKey or keyCommand = followStop)
- if (keyCommand = followKey)
- ControlSend,, {F2}, ahk_id %this_id%
- else
- ControlSend,, "s", ahk_id %this_id%
- ControlSend,, %keyCommand%, ahk_id %this_id%
- }
- }
- ; We want all other hotkeys in this app to only execute when AO is the active window
- #IfWinActive, Anarchy Online
- ~`::GoSub PauseHotKeys
- ~1::SendToAO("1")
- ~2::SendToAO("2")
- ~3::SendToAO("3")
- ~4::SendToAO("4")
- ~5::SendToAO("5")
- ~6::SendToAO("6")
- ~7::SendToAO("7")
- ~8::SendToAO("8")
- ~9::SendToAO("9")
- ~0::SendToAO("0")
- ~a::SendToAO("a")
- ~b::SendToAO("b")
- ~c::SendToAO("c")
- ~d::SendToAO("d")
- ~e::SendToAO("e")
- ~f::SendToAO("f")
- ~g::SendToAO("g")
- ~h::SendToAO("h")
- ~i::SendToAO("i")
- ~j::SendToAO("j")
- ~k::SendToAO("k")
- ~l::SendToAO("l")
- ~m::SendToAO("m")
- ~n::SendToAO("n")
- ~o::SendToAO("o")
- ~p::SendToAO("p")
- ~q::SendToAO("q")
- ~r::SendToAO("r")
- ~s::SendToAO("s")
- ~t::SendToAO("t")
- ~u::SendToAO("u")
- ~v::SendToAO("v")
- ~w::SendToAO("w")
- ~x::SendToAO("x")
- ~y::SendToAO("y")
- ~z::SendToAO("z")
- ~NumPad1::SendToAO("{Numpad1}")
- ~NumPad3::SendToAO("{Numpad3}")
- ~NumPad9::SendToAO("{Numpad9}")
- ~NumPad0::SendToAO("{Numpad0}")
- ~NumPadMult::SendToAO("{NumpadMult}")
- ~NumPadDot::SendToAO("{NumpadDot}")
- ~Insert::SendToAO("{Insert}")
- ~Delete::SendToAO("{Delete}")
- ~Home::SendToAO("{Home}")
- ~End::SendToAO("{End}")
- ~Space::SendToAO("{Space}")
- ~Esc::SendToAO("{Esc}")
- ~F1::SendToAO("{F1}")
- ~F2::SendToAO("{F2}")
- ~F3::SendToAO("{F3}")
- ~F4::SendToAO("{F4}")
- ~F5::SendToAO("{F5}")
- ~F6::SendToAO("{F6}")
- ~[::SendToAO("[")
- ~]::SendToAO("]")
- ~`;::SendToAO(";")
- ~'::SendToAO("'")
- ~,::SendToAO(",")
- ~.::SendToAO(".")
- ~-::SendToAO("-")
- ~=::SendToAO("=")
- ~Tab::SendToAO("{Tab}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement