-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
helpmecode.ahk
65 lines (60 loc) · 1.76 KB
/
helpmecode.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
63
64
65
#Include Socket.ahk
;SET IP ADDRESS OF PYTHON SERVER HERE...
ipAddress := "192.168.0.3" ; ENTER YOUR IP FROM THE PYTHON SCREEN
if ipAddress = ""
ipAddress = %A_IPAddress1%
myTcp := new SocketTCP()
try
{
myTcp.Connect([ipAddress, 8337])
}
catch e
{
MsgBox, 64, Error, Either the python server is inaccessible, or you did not edit this script to include it's lan IP
Exit
}
msgbox , , ,helpmecode AugmentedIntelligence, Connected. `r`n Type helpme and your query in your editor. `r`n Reload app with Ctrl+Alt+R `r`n to quit app Ctrl+Alt+Q
:*B0:helpme:: ; typing helpme triggers the function to read your input...
WinGetTitle, title, A
if title not contains Visual Studio Code, Notepad++, SciTE4AutoHotkey, Sublime, Atom
return
Input, query, V, {Enter}{Esc}{Tab} ;... and {enter} submits the query
Sleep 100
SendRaw % howdoiquery(query,myTcp)
return
howdoiquery(query, myTcp)
{
WinGetTitle, title, A
{ ;...looks for common code extensions in window title to restrict search
if title contains .ahk, .AHK
query .= " autohotkey"
Else if title contains .py, .PY
query .= " python"
Else if title contains .sql, .SQL
query .= " sql"
Else if title contains .groovy
query .= " groovy"
Else if title contains .go, .GO
query .= " go"
Else if title contains .cs, .CS
query .= " c#"
Else if title contains .sh, .SH
query .= " bash"
Else if title contains .js, .JS
query .= " javascript"
Else if title contains .jsx
query .= " javascript react"
}
SendInput, {Enter}
Sleep 10
command := "howdoi"
command .= ";" . query
;msgbox %command%
myTcp.SendText(command)
SetKeyDelay, 80
Send, let me see ... {Enter}
SetKeyDelay, 5
return myTcp.recvText(2048)
}
^!r::Reload
^!q::ExitApp