-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_text_of_open_program.ahk
62 lines (47 loc) · 1.46 KB
/
demo_text_of_open_program.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
; Run, Calc.exe
; WinWait, Calculator
F1::
WinGetTitle, title, A
; MsgBox, title:%title%
WinGetText, text, %title% ; The window found above will be used.
; MsgBox, The text is:`n%text%
txtpath = %localappdata%\medicine\medicine.txt
FileDelete, %txtpath%
FileAppend, %text%, %txtpath%
Run, C:/Program Files/ALTERNET/Medicine/Medicine.exe
WinClose, %title%
Return
F2::
WinGetTitle, Title, A
MsgBox, %Title%
Return
F3::
ExitApp, 1
F4::
MsgBox, here we go
list := WTSEnumProcesses()
spitted := StrSplit(list, A_Space, ",")
max := splitted.MaxIndex()
MsgBox, % max
Loop, % splitted.MaxIndex()
{
current := splitted%A_Index%
MsgBox, % current
}
Return
WTSEnumProcesses( Mode := 1 ) { ; By SKAN, http://goo.gl/6Zwnwu, CD:24/Aug/2014 | MD:25/Aug/2014
Local tPtr := 0, pPtr := 0, nTTL := 0, LIST := ""
If not DllCall( "Wtsapi32\WTSEnumerateProcesses", "Ptr",0, "Int",0, "Int",1, "PtrP",pPtr, "PtrP",nTTL )
Return "", DllCall( "SetLastError", "Int",-1 )
tPtr := pPtr
Loop % ( nTTL )
LIST .= ( Mode < 2 ? NumGet( tPtr + 4, "UInt" ) : "" ) ; PID
. ( Mode = 1 ? A_Tab : "" )
. ( Mode > 0 ? StrGet( NumGet( tPtr + 8 ) ) "," : "," ) ; Process name
, tPtr += ( A_PtrSize = 4 ? 16 : 24 ) ; sizeof( WTS_PROCESS_INFO )
StringTrimRight, LIST, LIST, 1
DllCall( "Wtsapi32\WTSFreeMemory", "Ptr",pPtr )
Return LIST, DllCall( "SetLastError", "UInt",nTTL )
}
PidOfProgram(list) {
}