-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdevmgmt.ahk
101 lines (74 loc) · 2.61 KB
/
devmgmt.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
AUTOEXEC_devmgmt: ; Workaround for Autohotkey's ugly auto-exec feature. Must be first line.
global g_DevmpEditbox
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
return ; End of auto-execute section.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;==============================================================
; 2016-09-27: devmgmt.msc hotkeys
;==============================================================
Is_mmc_window()
{
return dev_IsExeActive("mmc.exe")
}
devmgmt_IsViewingDetailTab(Awinid)
{
; Surprise! This can succeed as long as the/a device property dialog is open
; and you have displayed the Details tab at least once.
; Check Combobox1(device property list) exists and there is at least 10 entries.
ControlGet, otext, List, , Combobox1, ahk_id %Awinid%
if(!otext)
return false
lines := StrCountLines(otext)
if(lines<10)
return false
ControlGet, otext, List, , SysListView321, ahk_id %Awinid%
if(!otext)
return false
return true
}
#If Is_mmc_window()
F12:: devmgmt_DetailTabShowAllProperties()
devmgmt_DetailTabShowAllProperties()
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetTitle, title, ahk_id %Awinid%
if(!devmgmt_IsViewingDetailTab(Awinid))
{
Msgbox, % "devmgmt.ahk: You're not viewing a device property Details tab."
return false
}
text_result := "== " . title . " ==`n`n"
; Iterate each Combobox1(device property list) item, and grab each corresponding ListView321 text.
ControlGet, all_props, List,, Combobox1, ahk_id %Awinid%
count_props := StrCountLines(all_props)
Loop, %count_props%
{
Control, Choose, %A_Index%, Combobox1, ahk_id %Awinid%
ControlGetText, text_prop, Combobox1, ahk_id %Awinid%
ControlGet, text_val, List, , SysListView321, ahk_id %Awinid%
text_result .= A_Index . ".[" . text_prop . "]`n" . text_val . "`n`n"
}
; dev_WriteLogFile("_log1.txt", text_result, true)
; dev_SetClipboardWithTimeout(text_result)
; Msgbox, % title . " (" . count_props . " items) sent to clipboard."
Gui, Devmp:New
Gui, Devmp:+Resize +MinSize
Gui, Devmp:Add, Text,, %title%
Gui, Devmp:Add, Edit, r20 vg_DevmpEditbox, %text_result%
; Gui, Devmp:Add, Button, Default, OK
Gui, Devmp:Show
}
; Q: How can I avoid using the *exclusive* GuiEscape label, and at the same time
; allow multiple popups of the my GUI window?
DevmpGuiClose:
DevmpGuiEscape:
; This enables ESC to close AHK window.
Gui, Devmp:Destroy
return
DevmpGuiSize()
{
rsdict := {}
rsdict.g_DevmpEditbox := "0,0,100,100" ; Left/Top/Right/Bottom
dev_GuiAutoResize("Devmp", rsdict, A_GuiWidth, A_GuiHeight)
}
#If ;Is_mmc_window()