-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.ahk
62 lines (46 loc) · 1.45 KB
/
search.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
52
53
54
55
56
57
58
59
60
61
62
;
; search.ahk
;
UrlEscape( url, flags ) {
VarSetCapacity( newUrl,4096,0 ), pcche := 4096
DllCall( "shlwapi\UrlEscapeW", Str,url, Str,newUrl, UIntP,pcche, UInt,flags )
Return newUrl
}
UrlUnEscape( url, flags ) {
VarSetCapacity( newUrl,4096,0 ), pcche := 4096
DllCall( "shlwapi\UrlUnescapeW", Str,url, Str,newUrl, UIntP,pcche, UInt,flags )
Return newUrl
}
OpenURL(url, title:="") {
prevClipboard := ClipboardAll
Clipboard =
Send, ^c
ClipWait
if (!ErrorLevel) {
aStr := UrlEscape( RegExReplace(RegExReplace(Clipboard, "\r?\n"," "), "(^\s+|\s+$)"), 0x00080000 | 0x00002000 | 0x00001000)
Clipboard := prevClipboard
if SubStr(aStr,1,8)="https://"
Run, %aStr%
else
Run, %url%%aStr%
if title {
WinWait, %title%
WinActivate, %title%
}
}
}
#^s:: ; YaTranslate with Win+Ctrl+s
OpenURL("https://translate.yandex.ru/?clid=41279&yasoft=punto&text=")
return
#^w:: ; Search in WikiPedia with Win+Ctrl+w
OpenUrl("https://en.wikipedia.org/wiki/")
return
#^r:: ; Search in RU WikiPedia with Win+Ctrl+r
OpenUrl("https://ru.wikipedia.org/wiki/")
return
#^g:: ; Search in Google with Win+Ctrl+g
OpenUrl("https://www.google.com/search?q=")
return
#^h:: ; Search in cppreference.com with Win+Ctrl+h
OpenUrl("https://en.cppreference.com/mwiki/index.php?search=")
return