Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; twitch.tv/unsane
- ; Updated for 3.1 Abyss.
- ; Copy and paste this text into unsane.ahk. POE-TradeMacro is required: https://github.com/PoE-TradeMacro/POE-TradeMacro/releases. Put unsane.ahk (and cports.exe) in the root folder of POE-TradeMacro, and launch ONLY unsane.ahk to launch everything (PoE, POE-TradeMacro, the macros in this file, POELadder, poe-racing ladder).
- ; This is my personal file with a bunch of custom stuff tailored to my setup. You will need to go through and edit file locations, screen coordinates, and preferred shortcut keys.
- #NoEnv ; good to use until it's default in ahkV2
- #SingleInstance force
- #Persistent ; Stay open in background
- SendMode Input
- full_command_line := DllCall("GetCommandLine", "str")
- if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")) {
- try {
- Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
- }
- ExitApp
- }
- ; The following is borrowed from the lutbot macro. See http://lutbot.com
- GetTable := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Iphlpapi.dll", "Ptr"), Astr, "GetExtendedTcpTable", "Ptr")
- SetEntry := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Iphlpapi.dll", "Ptr"), Astr, "SetTcpEntry", "Ptr")
- EnumProcesses := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Psapi.dll", "Ptr"), Astr, "EnumProcesses", "Ptr")
- preloadPsapi := DllCall("LoadLibrary", "Str", "Psapi.dll", "Ptr")
- OpenProcessToken := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Advapi32.dll", "Ptr"), Astr, "OpenProcessToken", "Ptr")
- LookupPrivilegeValue := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Advapi32.dll", "Ptr"), Astr, "LookupPrivilegeValue", "Ptr")
- AdjustTokenPrivileges := DllCall("GetProcAddress", Ptr, DllCall("LoadLibrary", Str, "Advapi32.dll", "Ptr"), Astr, "AdjustTokenPrivileges", "Ptr")
- global dndOn := false
- global isActivePoeLadder := 0
- global isActivePoeRacing := 0
- ; Put the event name and your char name here. Can get event at http://poe-racing.com etc.
- global URL = "http://poe-racing.com/?event=10 Day Mayhem HC (ORE005)&name=unsaneTakeTwo&size=1"
- global WB
- OnExit("Cleanup")
- ; This timer is used to check whether PoE is open, every 60 seconds. If it's not it closes the macros and POELadder.
- SetTimer process_watcher, 60000
- Process Exist, PathOfExile_x64.exe
- If ErrorLevel = 0
- {
- Process Exist, PathOfExile.exe
- If ErrorLevel = 0
- {
- ;--noasync (iirc preloads assets when zoning in rather than on the fly) --waitforpreload
- Run cmd.exe /c start "" /high /d "C:\Program Files (x86)\Path of Exile" "C:\Program Files (x86)\Path of Exile\Client.exe"
- }
- }
- ; The following is to launch POE-TradeMacro, which i run in parallel.
- Run %A_ScriptDir%\Run_TradeMacro.ahk -nosplash
- ; launch these manually. can make automatic here if i'm on a long-term character:
- TogglePoeLadder()
- ;TogglePoeRacing()
- ; disable click-dragging live POELadder
- $LButton::
- if(!isActivePoeLadder) {
- Send {LButton Down}
- KeyWait LButton
- Send {LButton Up}
- }
- else {
- MouseGetPos, , , Win
- WinGetTitle, Title, ahk_id %Win%
- if(Title!="Path of Exile Ladder") {
- Send {LButton Down}
- KeyWait LButton
- Send {LButton Up}
- }
- else {
- WinGetPos, , , , Height, Path of Exile Ladder ; input window: 279, fetching window: 120
- if(Height > 200) {
- Send {LButton Down}
- KeyWait LButton
- Send {LButton Up}
- }
- ;else
- ;disabled the click
- }
- }
- return
- ; Check every 60 seconds whether PoE is closed, if yes, close POELadder and macro processes
- process_watcher:
- Process Exist, PathOfExile.exe
- If ErrorLevel = 0
- {
- Process Exist, PathOfExile_x64.exe
- If ErrorLevel = 0
- {
- IfWinExist, Path of Exile Ladder
- WinClose
- ; Run,%ComSpec% /c Taskkill -f -im autohotkey.exe,%A_ScriptDir%,Hide
- DetectHiddenWindows, On
- WinGet, List, List, ahk_class AutoHotkey
- Loop %List% {
- WinGet, PID, PID, % "ahk_id " List%A_Index%
- If ( PID <> DllCall("GetCurrentProcessId") )
- PostMessage,0x111,65405,0,, % "ahk_id " List%A_Index%
- }
- SetTitleMatchMode 1
- Exitapp
- }
- }
- return
- ; hotkey command list:
- F4::FastLogOut() ; keep this outside #ifwinactive so it's active everywhere in case of popups
- #IfWinActive Path of Exile ahk_class POEWindowClass
- !Enter::return ; block alt+enter key combinations from going to/alternating windowed/fullscreen
- !NumpadEnter::return ; block alt+enter key combinations from going to/alternating windowed/fullscreen
- #=::return ; block winkey+= magnifier
- #NumpadAdd::return ; block winkey++ magnifier
- ;CapsLock::` ; reassign capslock for use with discord push-to-talk
- ;#L::return ; block winkey+L (didn't work as is)
- ^+p::TogglePoeRacing() ; ctrl+shift+p Toggle the poe-racing ladder display on/off. Use when placed #1-2500.
- ^+o::TogglePoeLadder() ; ctrl+shift+o Toggle the poe-ladder display on/off. Use when placed #2501-15000.
- ;F1 = fps ; in-game shortcut
- F2::Hideout()
- F3::Ignore()
- F5::AfterMap()
- F6::Played()
- ;F7::Whois() ; probly dont need this anymore now that ctrl+alt+r. first candidate for deletion. commented out, see if i miss it
- F7::InviteX()
- F8::Invite()
- F9::DND()
- F10::Ladder()
- ;F11 = screenshot ; in-game shortcut
- F12::CommandList()
- ;ctrl+c POE-TradeMacro: See item info (via PoE-ItemInfo).
- ;ctrl+alt+c POE-TradeMacro AdditionalMacro: Opens an item on pathof.info for an advanced affix breakdown
- ;ctrl+d POE-TradeMacro: Search item on poe.trade.
- ;ctrl+alt+d POE-TradeMacro: Advanced item search for uniques.
- ;ctrl+e POE-TradeMacro: Show item age (own listed items).
- ;ctrl+f POE-TradeMacro AdditionalMacro: Fills stash/vendor search with itemname/info you're hovering
- ;ctrl+alt+f POE-TradeMacro AdditionalMacro: Much broader search terms
- ;ctrl+i POE-TradeMacro: Opens a text input where you can type an item name to search for.
- ;ctrl+l POE-TradeMacro: Change league.
- ;ctrl+m POE-TradeMacro AdditionalMacro: Open poeaffix.net w/ item you're hovering
- ;ctrl+q POE-TradeMacro: Open the item search on poe.trade instead of showing a tooltip with results.
- ;ctrl+alt+r POE-TradeMacro AdditionalMacro: Sends "/whois lastWhisperCharacterName".
- ;ctrl+w POE-TradeMacro: Open the items wiki page.
- ;alt-1 [old, not yet reimplemented] "BEARERS BEARERS BEARERS!!!"
- ;alt-2 [old, not yet reimplemented] "Watch for corrupting blood!"
- ;alt-3 [old, not yet reimplemented] "Dangerous exile!"
- ;zzz
- !1::Send {Enter}/invite Wakazashi{Enter} ; CT
- !2::Send {Enter}/invite DawnSunderer{Enter} ; SB
- !3::Send {Enter}/invite IamBitter{Enter} ; RK
- !4::Send {Enter}/invite QueueQueue_EDMoM{Enter} ; TM
- !5::Send {Enter}/invite rexiwexid{Enter} ; W
- ; The below overrides the normal PoE scrollwheel behavior. To temporarily use normal behavior, hold ctrl, alt or shift.
- WheelUp::SendInput {Left} ;mouse wheel up toggles stash tabs left
- WheelDown::SendInput {Right} ;mouse wheel down toggles stash tabs right
- ; The following is to launch and set up POELadder, which i run in parallel. Launch it, click start, and move it. Download https://github.com/CNParent/poe-ladder/releases and put it somewhere.
- TogglePoeLadder() {
- if !isActivePoeLadder {
- isActivePoeLadder := true
- Run cmd.exe /c start "" /high /d "C:\Program Files (no registry)\poe-ladder-win32-x64" "C:\Program Files (no registry)\poe-ladder-win32-x64\poe-ladder.exe"
- Sleep, 15000 ; was 20000+7000
- BlockInput On
- WinActivate Path of Exile Ladder
- Click 50, 125 ; Click Start on it
- BlockInput Off
- ; WinActivate, Path of Exile ahk_class POEWindowClass
- Sleep, 3000 ; was 7000
- ;orig/old WinMove, Path of Exile Ladder, , 755, 670 ; Move it to where i want it
- ; base window is 200x60 (poe-racing is 170x62)
- WinMove, Path of Exile Ladder, , 775, 661 ; Move it to where i want it
- }
- else {
- isActivePoeLadder := false
- IfWinExist, Path of Exile Ladder
- WinClose
- }
- return
- }
- class WB_events {
- NavigateComplete2(wb, NewURL) {
- GuiControl,, URL, %URL%
- }
- }
- TogglePoeRacing() {
- if !isActivePoeRacing {
- isActivePoeRacing := true
- Gui +LastFound +AlwaysOnTop -Caption -Border +ToolWindow +E0x20
- Gui, Color, FFFFFF
- Gui, Margin, 0, 0
- ;orig/old Gui Add, ActiveX, w170 h62 x0 y0 vWB, %URL%
- Gui Add, ActiveX, w200 h62 x0 y0 vWB, %URL%
- WinSet, TransColor, FFFFFF 200 ; Change 200 to a lower value if you want the tracker to be more transparent.
- ComObjConnect(WB, WB_events)
- ;orig/old Gui Show, x755 y670 NoActivate, Tracker
- Gui Show, x775 y660 NoActivate, Tracker
- WinSet AlwaysOnTop, On
- WB.Navigate(URL)
- }
- else {
- isActivePoeRacing := false
- Gui, Destroy
- }
- return
- }
- AfterMap() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- Send ^{Enter}After map. Negotiate/invite you at that time?{Enter}
- ; Send ^{Enter}After map. Am i not in a map? Then i'm busy and not trading.{Enter}
- ; Send ^{Enter}Speed levelling. 5c sale minimum.{Enter}
- BlockInput Off
- }
- return
- }
- FastLogOut() {
- Critical
- Process Exist, PathOfExile.exe
- If ErrorLevel
- {
- ; Ensure you have cports.exe in the root POE-TradeMacro folder http://www.nirsoft.net/utils/cports.html
- Run, cports.exe /close * * * * PathOfExile.exe
- }
- Else
- {
- Process Exist, PathOfExile_x64.exe
- If ErrorLevel
- {
- ; The following is borrowed from the lutbot macro. See http://lutbot.com
- succ := logout("PathOfExile_x64.exe")
- if (succ == 0) {
- newSucc := logout("PathOfExile.exe")
- }
- }
- }
- return
- }
- ; The following is borrowed from the lutbot macro. See http://lutbot.com
- logout(executable) {
- global GetTable, SetEntry, EnumProcesses, OpenProcessToken, LookupPrivilegeValue, AdjustTokenPrivileges, loadedPsapi
- Critical
- poePID := Object()
- s := 4096
- Process, Exist
- h := DllCall("OpenProcess", "UInt", 0x0400, "Int", false, "UInt", ErrorLevel, "Ptr")
- DllCall(OpenProcessToken, "Ptr", h, "UInt", 32, "PtrP", t)
- VarSetCapacity(ti, 16, 0)
- NumPut(1, ti, 0, "UInt")
- DllCall(LookupPrivilegeValue, "Ptr", 0, "Str", "SeDebugPrivilege", "Int64P", luid)
- NumPut(luid, ti, 4, "Int64")
- NumPut(2, ti, 12, "UInt")
- r := DllCall(AdjustTokenPrivileges, "Ptr", t, "Int", false, "Ptr", &ti, "UInt", 0, "Ptr", 0, "Ptr", 0)
- DllCall("CloseHandle", "Ptr", t)
- DllCall("CloseHandle", "Ptr", h)
- s := VarSetCapacity(a, s)
- c := 0
- DllCall(EnumProcesses, "Ptr", &a, "UInt", s, "UIntP", r)
- Loop, % r // 4
- {
- id := NumGet(a, A_Index * 4, "UInt")
- h := DllCall("OpenProcess", "UInt", 0x0010 | 0x0400, "Int", false, "UInt", id, "Ptr")
- if !h
- continue
- VarSetCapacity(n, s, 0)
- e := DllCall("Psapi\GetModuleBaseName", "Ptr", h, "Ptr", 0, "Str", n, "UInt", A_IsUnicode ? s//2 : s)
- if !e
- if e := DllCall("Psapi\GetProcessImageFileName", "Ptr", h, "Str", n, "UInt", A_IsUnicode ? s//2 : s)
- SplitPath n, n
- DllCall("CloseHandle", "Ptr", h)
- if (n && e)
- if (n == executable) {
- poePID.Insert(id)
- }
- }
- l := poePID.Length()
- if ( l = 0 ) {
- Process, wait, %executable%, 0.2
- if ( ErrorLevel > 0 ) {
- poePID.Insert(ErrorLevel)
- }
- }
- VarSetCapacity(dwSize, 4, 0)
- result := DllCall(GetTable, UInt, &TcpTable, UInt, &dwSize, UInt, 0, UInt, 2, UInt, 5, UInt, 0)
- VarSetCapacity(TcpTable, NumGet(dwSize), 0)
- result := DllCall(GetTable, UInt, &TcpTable, UInt, &dwSize, UInt, 0, UInt, 2, UInt, 5, UInt, 0)
- num := NumGet(&TcpTable,0,"UInt")
- out := 0
- Loop %num%
- {
- cutby := a_index - 1
- cutby *= 24
- ownerPID := NumGet(&TcpTable,cutby+24,"UInt")
- for index, element in poePID {
- if ( ownerPID = element )
- {
- VarSetCapacity(newEntry, 20, 0)
- NumPut(12,&newEntry,0,"UInt")
- NumPut(NumGet(&TcpTable,cutby+8,"UInt"),&newEntry,4,"UInt")
- NumPut(NumGet(&TcpTable,cutby+12,"UInt"),&newEntry,8,"UInt")
- NumPut(NumGet(&TcpTable,cutby+16,"UInt"),&newEntry,12,"UInt")
- NumPut(NumGet(&TcpTable,cutby+20,"UInt"),&newEntry,16,"UInt")
- result := DllCall(SetEntry, UInt, &newEntry)
- out++
- }
- }
- }
- return True
- }
- Played() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- Send {Enter}/played{Enter}
- BlockInput Off
- }
- return
- }
- Ladder() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- Send {Enter}/ladder{Enter}
- BlockInput Off
- }
- return
- }
- Invite() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- Send ^{Enter}{Home}{Delete}/invite {Enter}
- BlockInput Off
- }
- return
- }
- InviteX() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- ;zzz
- Send {Enter}/invite WakaOctoCurse{Enter}
- Send {Enter}/invite WakaOcto{Enter}
- BlockInput Off
- }
- return
- }
- Whois() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- Send {Enter}/whois %Clipboard%{Enter}
- BlockInput Off
- }
- return
- }
- DND() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- if (dndOn)
- Send {Enter}/dnd{Enter}
- else
- Send {Enter}/dnd Lab/racing/busy. /whois me and try again shortly.{Enter}
- BlockInput Off
- dndOn := !dndOn
- }
- return
- }
- Hideout() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- Send {Enter}/hideout{Enter}
- BlockInput Off
- }
- return
- }
- Clear() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- Send {Enter}/clear{Enter}
- BlockInput Off
- }
- return
- }
- Ignore() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- Send ^{Enter}{Home}{Delete}/ignore {Enter}
- BlockInput Off
- }
- return
- }
- CommandList() {
- if WinActive("Path of Exile ahk_class POEWindowClass")
- {
- BlockInput On
- Send {Enter}+{Home}{Delete}F1=fps/ping, F2=/hideout, F3=/ignore, F4=exit, F5=AfterMap, F6=/played, F7=/whois, F8=/invite, F9=/dnd, F10=/ladder, F11=screenshot, F12=ThisList.{Enter}
- Send {Enter}* Ctrl-C: iinfo * Ctrl-D: TradeValue * Ctrl-Alt-D: advanced Uniq search * Ctrl-I: iname poetrade search * Ctrl-W: iwiki * Ctrl-Q: ipoetrade * Ctrl-E: iage * Ctrl-L: chg league *{Enter}
- ; Send {Enter}* Alt-1: BEARERS * Alt-2/3/4/5: invite friends *{Enter}
- ; Send {Enter}* Ctrl-F: Search with hover item * Ctrl-Alt-F: Search much broader * Ctrl-M: poeaffix * Ctrl-Alt-C: pathof.info * Ctrl-Alt-R: /whois *{Enter}
- Send {Enter}* Ctrl-M: poeaffix * Ctrl-Alt-C: pathof.info * Ctrl-Alt-R: /whois * Ctrl-Shift-O: Toggle poe-ladder * Ctrl-Shift-P: Toggle poe-racing ladder *{Enter}
- BlockInput Off
- }
- return
- }
- Cleanup() {
- IfWinExist, Path of Exile Ladder
- WinClose
- ExitApp
- }
Advertisement
Add Comment
Please, Sign In to add comment