forked from poeapp/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitem-import.ahk
51 lines (43 loc) · 1.17 KB
/
item-import.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
; Video Guide: https://gfycat.com/ExcitablePettyAmericanavocet
; HOWTO: https://autohotkey.com/docs/Tutorial.htm#s12
;SingleInstance force
;SetTitleMatchMode, 3
; https://autohotkey.com/board/topic/35660-url-encoding-function/#entry294368
UriEncode(Uri, Enc = "UTF-8")
{
StrPutVar(Uri, Var, Enc)
f := A_FormatInteger
SetFormat, IntegerFast, H
Loop
{
Code := NumGet(Var, A_Index - 1, "UChar")
If (!Code)
Break
If (Code >= 0x30 && Code <= 0x39 ; 0-9
|| Code >= 0x41 && Code <= 0x5A ; A-Z
|| Code >= 0x61 && Code <= 0x7A) ; a-z
Res .= Chr(Code)
Else
Res .= "%" . SubStr(Code + 0x100, -1)
}
SetFormat, IntegerFast, %f%
Return, Res
}
StrPutVar(Str, ByRef Var, Enc = "")
{
Len := StrPut(Str, Enc) * (Enc = "UTF-16" || Enc = "CP1200" ? 2 : 1)
VarSetCapacity(Var, Len, 0)
Return, StrPut(Str, &Var, Enc)
}
#ifWinActive, Path of Exile
; F8 can be changed to whatever hotkey works best for you.
; https://autohotkey.com/docs/Hotkeys.htm#Symbols
F8::
clipPrev := Clipboard
Send ^{sc02E}
Sleep 250
itemContents := UriEncode(Clipboard)
Clipboard := clipPrev
Run, https://poeapp.com/#/item-import/%itemContents%
return
#ifWinActive