-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwindev.ahk
821 lines (610 loc) · 20.6 KB
/
windev.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
AUTOEXEC_windev: ; Workaround for Autohotkey's ugly auto-exec feature. Must be first line.
global g_VSDlg_sleep_bfr_close := 100
global g_isNavibackTriggered := false
MSHV22_DefineHotkeys()
chj_LINQPadInit()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
return ; End of auto-execute section.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
windev_HideTooltip:
tooltip
return
;==============================================================
; Visual Studio 6 (VC6) with VAX
;==============================================================
#If IsWinTitleMatchRegex("Microsoft Visual C++")
; Not to match ahk_class, because VC6's class name is Afx:....
^`:: ; in hope clicking on FileView pane
ClickInActiveControl("SysTabControl321", 0.4, 0.5)
return
;^!4:: ; click on VA Outline tab
; ClickInActiveControl("SysTabControl321", 0.9, 0.5)
;return
CapsLock & Right UP:: VC6_FocusCodeArea()
VC6_FocusCodeArea()
{
static s_flip = 0 ; consider that VC6 code area may be splitted into two panes
arpos := [ "0.8,0.2" , "0.8,0.8" ]
s_flip := not s_flip
; "MDIClient" is the VC6 code area(the big pane on the right side).
; This area may be splitted into four panes, so we will cycle through
; each of them on every call of this function.
nowpos := arpos[s_flip+1] ; Ahk array index is 1-based
p := StrSplit(nowpos, ",")
ControlFocusViaRegexClassNNXY("^MDIClient[0-9]+$", false, p[1], p[2], true, true)
}
CapsLock & Left UP:: VC6_FocusLeftPane()
VC6_FocusLeftPane() ; Here, Left-pane mean the workspace pane area
{
ControlGetPos, x, y, width, height, SysTabControl321, A ; find the gang-tabs
if not x
return
; Now focus(click) the control right above the gang-tabs
MouseMove, % x+8 , % y-8
/*
MouseGetPos, _mx, _my, , leftpane_classnn
ControlGetPos, x, y, width, height, %leftpane_classnn%, A
tooltip, leftpane=%leftpane_classnn% (%x% . %y%) / (%width% . %height%)
; [2015-02-10]
; VERY Strange! The above ControlGetPos always return blank for x, y, width, height
; although leftpane_classnn contains a (看上去) utterly valid value, something like:
; Afx:400000:8:19990:0:01
ClickInActiveControl(leftpane_classnn, -2, 2, true)
*/
; The workaround is, just Click inside the pane.
Click
}
#If
;==============================================================
; Visual Studio 2008+ & its counterpart Document Explorer
;==============================================================
VS2008_IsActive()
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetClass, class, ahk_id %Awinid%
WinGetTitle, title, ahk_id %Awinid%
if( class=="wndclass_desked_gsk" and title~="Microsoft Visual Studio" ) ; ~= means regex match(substring match)
return true
else
return false
}
VS2010_IsActive()
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetClass, class, ahk_id %Awinid%
WinGetTitle, title, ahk_id %Awinid%
; WinGet, exepath, ProcessPath, ahk_id %Awinid%
; ~= means regex match(can be used as substring match)
if( class~="^HwndWrapper" and title~="Microsoft Visual Studio" and dev_IsExeActive("devenv.exe"))
return true
else
return false
}
MSDN2008_IsActive() ; Is "MSDN Library - Visual Studio 008 - Microsoft Document Explorer" window active
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetClass, class, ahk_id %Awinid%
WinGetTitle, title, ahk_id %Awinid%
if( class=="wndclass_desked_gsk" and title~="Microsoft Document Explorer" ) ; ~= means regex match(substring match)
return true
else
return false
}
MSDN2008_ActivateGroup()
{
; Call this to activate MSDN2008 window
MyActivateWindowGroupFlex("wndclass_desked_gsk", "", "Microsoft Document Explorer", "VS2008 MSDN Documents")
}
#If VS2008_IsActive()
; Most operation's shortcut can be defined with Tools -> Options -> Keyboard
; CapsLock & F8:: Send +^!{F8} ; TabsStudio previous tab (?)
; CapsLock & F9:: Send +^!{F9} ; TabsStudio next tab
#If ; #If VS2008_IsActive()
#If MSDN2008_IsActive()
;F10:: MSDN2008_Focus_IndexPane() ; This is configurable @ Help.Index
F12:: MSDN2008_Focus_MainPane()
CapsLock & Right:: MSDN2008_Focus_MainPane()
CapsLock & Up:: MSDN2008_Focus_MainPane()
CapsLock & Down:: MSDN2008_Focus_IndexResult()
; === Sample usage ===
; ; Pressing WinApp+8 *twice* will bring up MSDN2008 window and focus the Index editbox
; AppsKey & 8::
; if(MSDN2008_IsActive())
; MSDN2008_Focus_IndexPane()
; else
; MSDN2008_ActivateGroup()
; return
MSDN2008_Focus_MainPane()
{
; ControlFocus, % "Internet Explorer_Server1" ; [2015-11-05] Don't know why this results in vain.
ClickInActiveControl("Internet Explorer_Server1", 8, -2)
; Note: Clicking left-bottom instead of left-top, because some docpage(CWnd::BeginPaint etc)
; is HTML-framed who has a fixed banner. Clicking that fixed banner will not transfer focus
; to the scrollable "main" area.
}
MSDN2008_Focus_IndexResult()
{
; ControlFocus, % "SysListView321"
ClickInActiveControl("SysListView321", -2,-2)
}
MSDN2008_Focus_IndexPane()
{
Send !i
Send !l
; Flaw: When Help.Contents has focus, this key seq does not work.
}
#If ; #If MSDN2008_IsActive()
;===========================================================================
; MS Help Viewer 1.x /2.x(VS2015Doc)
;===========================================================================
; It's weird that MSHV 2.x's "left pane" is not a control, which causes lots of AHK automation trouble.
MSHV_IsActive() ; MSHV: MS Help Viewer 1.x/2.x for VS2010/VS2013/(VS2015)
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetClass, class, ahk_id %Awinid%
WinGetTitle, title, ahk_id %Awinid%
if( class~="^HwndWrapper\[HlpViewer.exe" and title~="^Microsoft Help Viewer" ) ; ~= means regex match(substring match)
return true
else
return false
}
#If MSHV_IsActive()
F9:: MSHV_Focus_ContentPane()
F10:: MSHV_Focus_IndexPane()
F12:: MSHV_Focus_MainPane() ; no effect on VS2015
^Right:: MSHV_Focus_MainPane()
CapsLock & Right:: MSHV_Focus_MainPane()
CapsLock & Up:: MSHV_MainPane_Scroll("Up")
CapsLock & Down:: MSHV_MainPane_Scroll("Down")
CapsLock & Left::
Send !i
Send {Tab} ; not reliable
return
^LButton:: Send !{Left}
^RButton:: Send !{Right}
; While pressing down mouse right-button, left click do Navigate Back.
; Hint(when you delete the two MouseMove line): To avoid right-click context memu pop-up, you have to manually.
~RButton & LButton:: MSHV_mousekey_naviback()
MSHV_mousekey_naviback()
{
Send !{Left}
; g_isNavibackTriggered := true
; The following two MouseMove have a tricky but desired effect: right-click context memu WON'T pop-up.
; and an undesired side-effect: You have to release the right-button and press it down before triggering a second this hotkey.
MouseMove, -20, 0, , R
MouseMove, 20, 0, , R
}
;~RButton up:: MSHV_RButton_up_tweak()
;MSHV_RButton_up_tweak()
;{
; if(g_isNavibackTriggered) {
; MouseMove, 20, 0, 1, R
; }
;}
; While pressing down mouse left-button, right click do Navigate Forward.
~LButton & RButton:: Send !{Right}
MSHV_Focus_MainPane(movemouse:=true)
{
ClickInActiveControl("Internet Explorer_Server1", 2, 0.5, movemouse, false)
}
MSHV_Focus_ContentPane()
{
Send !c
}
MSHV_Focus_IndexResult()
{
;ClickInActiveControl("SysListView321", -2,-2)
}
MSHV_Focus_IndexPane()
{
Send !i
}
MSHV_MainPane_Scroll(dir)
{
ControlClick, % "Internet Explorer_Server1", A, , Wheel%dir%, 1
}
#If ; MSHV_IsActive()
;===========================================================================
; MS Help Viewer 2.2 (VS2015 Doc)
;===========================================================================
#If MSHV22_IsActive() ; [2016-06-15] Note: If this line is deleted, F1~F9 will not work in other programs.
;#If ;MSHV22_IsActive()
NumpadDiv:: Send !{Left}
NumpadMult:: Send !{Right}
MSHV22_IsActive()
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetClass, class, ahk_id %Awinid%
WinGetTitle, title, ahk_id %Awinid%
if( class~="HwndWrapper" and title~="Microsoft Help Viewer 2.2" ) ; ~= means regex match(substring match)
return true
else
return false
}
MSHV22_FN_send_CtrlN(num)
{
static s_prevnum := 0
if(num==s_prevnum) {
MSHV_Focus_MainPane(false) ; Workaround the quick switch freeze bug of HV22 viewer
}
sendkey := "^" . num
Send %sendkey%
s_prevnum := num
}
MSHV22_DefineHotkeys()
{
; F1~F9 to send Ctr+1 ~ Ctrl+9 (switch doc tabs)
hotchars := "123456789"
Loop, parse, hotchars
{
dev_DefineHotkeyWithCondition("F" . A_LoopField, "MSHV22_IsActive", "MSHV22_FN_send_CtrlN", A_LoopField)
}
}
MSHV22_ActivateGroup()
{
MyActivateWindowGroupFlex(QSA_NO_WNDCLASS, "^HwndWrapper", "^Microsoft Help Viewer 2.2", "MS Help Viewer 2.2 (VS2015Doc)")
}
MSHV22_Focus_IndexPane()
{
Send !i
}
#If VS2008_IsActive() || VS2010_IsActive()
; Chj: Numpad / * switch to previous or next tab. (Requires TabsStudio)
NumpadDiv:: Send ^!{Left} ; TabsStudio.Connect.NavigateToPreviousTab
NumpadMult:: Send ^!{Right} ; TabsStudio.Connect.NavigateToNextTab
NumpadSub:: Send ^!{Pgup} ; TabsStudio.Connect.NextTabExtension [global]
NumpadAdd:: Send ^!{Pgdn} ; TabsStudio.Connect.MarkerNextTabHighlightingColor
^NumpadDiv:: Send ^1 ; TabsStudio.Connect.NavigateToTab1
^NumpadMult:: Send ^!{End} ; TabsStudio.Connect.NavigateToLastTab (Last=Rightmost)
;!NumpadDiv:: Send ^![ ; TabsStudio.Connect.MoveTabLeft
;!NumpadMult:: Send ^!] ; TabsStudio.Connect.MoveTabRight // this is defaultly used as Debug.ShowNextStatement
; [2022-01-14] Almost not using these for many years, using PgUp/PgDn is more natural
; And I think Alt+Up/Alt+Down should be reserved for more advanced C++ code navigation.
; !Up:: Send {Up 10}
; !Down:: Send {Down 10}
:*?:irpc``::Irp->CurrentLocation
:*?:irps``::Irp->Tail.Overlay.CurrentStackLocation
:*?:irps1``::((IO_STACK_LOCATION*)(Irp+1))[0]
:*?:irps2``::((IO_STACK_LOCATION*)(Irp+1))[1]
:*?:irps3``::((IO_STACK_LOCATION*)(Irp+1))[2]
CapsLock & Left:: ClickInActiveWindow(14, 0.5, false)
CapsLock & Right:: VS2010_FocusCodeArea()
VS2010_FocusCodeArea()
{
static s_flip = 0 ; consider that VC6 code area may be splitted into two panes
arpos := [ "0.6,0.3" , "0.6,0.7" ]
s_flip := not s_flip
nowpos := arpos[s_flip+1] ; Ahk array index is 1-based
p := StrSplit(nowpos, ",")
;ControlFocusViaRegexClassNNXY("^MDIClient[0-9]+$", false, p1, p2, true, true)
ClickInActiveWindow(p[1], p[2], false) ; false=not moving mouse
}
#If
;==============================================================
; Visual Studio 2010+ Property Pages
;==============================================================
VSIDE_IsPropertyPageActive() ; Is "MSDN Library - Visual Studio 008 - Microsoft Document Explorer" window active
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetClass, class, ahk_id %Awinid%
WinGetTitle, title, ahk_id %Awinid%
if( class=="#32770" and title~="Property Pages$" ) ; ~= means regex match(substring match)
return true
else
return false
}
#If VSIDE_IsPropertyPageActive()
; Override [Enter] to avoid accidentally close the Property-page dialog
Enter:: VSIDEPP_PressEnter()
VSIDEPP_PressEnter()
{
WinGet, Awinid, ID, A ; cache active window unique id
if(dev_IsClassnnFocused_regex("SysTreeView321"))
{ ; Set focus to right-side pane instead of close the dialog
VSIDEPP_FocusRightPane()
return
}
is_close := dev_MsgBoxYesNo("Save and close the Property Page dialog box?", false)
if(!is_close)
return
WinWaitActive, ahk_id %Awinid%, , 1.0
VSIDEPP_OK_CloseDialog()
}
VSIDEPP_OK_CloseDialog()
{
; ControlClick, Button1, A ; this often lost in vain
; so use ClickInActiveControl() instead.
Sleep, %g_VSDlg_sleep_bfr_close% ; If no sleep, sometimes "Button2" is missed. Don't know why.
ClickInActiveControl("Button1", 0.5, 0.5) ; Button1 is OK
}
^Enter:: VSIDEPP_OK_CloseDialog()
/* [2016-07-27] Find this Esc dialog boring, just set it aside.
Esc:: VSIDEPP_PressEsc()
VSIDEPP_PressEsc()
{
; static last_EscTick := 0
; now_tick := A_TickCount
; diff_tick := now_tick - last_EscTick
; last_EscTick := now_tick
;dev_TooltipAutoClear(diff_tick)
; if(diff_tick>1000) {
; VSIDEPP_Esc_CloseDialog()
; return
; }
; -- sigh, wish I could have the A_LastKey global...
WinGet, Awinid, ID, A ; cache active window unique id
is_close := dev_MsgBoxYesNo("Close the Property Page dialog box?", true, Awinid)
if(!is_close)
return
WinWaitActive, ahk_id %Awinid%, , 2.0
VSIDEPP_Esc_CloseDialog(Awinid)
}
*/
VSIDEPP_Esc_CloseDialog(dlg_winid:=0)
{
count := 0
while(1)
{
Sleep, %g_VSDlg_sleep_bfr_close% ; If no sleep, sometimes "Button2" is missed. Don't know why.
ClickInActiveControl("Button2", 0.5, 0.5) ; Button2 is Cancel
; Quite often, that click misses, so try it again.
if(dlg_winid==0)
break
if( (not IsWinidActive(dlg_winid)) or count>=3 )
break
Sleep, 500
count+=1
}
}
^Esc:: VSIDEPP_Esc_CloseDialog() ; somehow this does not always work
CapsLock & Left:: VSIDEPP_FocusLeftPane()
VSIDEPP_FocusLeftPane()
{
ControlFocus, SysTreeView321, A
}
CapsLock & Right:: VSIDEPP_FocusRightPane()
VSIDEPP_FocusRightPane()
{
ClickInActiveControlEx("SysTreeView321", 12,true, 0.2,false, true)
; Click 12 pixels beyond left-pane's right-side border.
; MEMO: When focus has been in right-side pane, Alt+Down can drop down the combobox
; for current item.
}
#If ; VSIDE_IsPropertyPageActive()
; Ins:: VAX_SurroundStringWith_T()
VAX_SurroundStringWith_T()
{
; For VS2010 + VisualAssist environment, quickly wrap a string with _T("...") .
; Place caret at starting or ending double-quotes, then use this hotkey.
dev_TooltipAutoClear("SurroundWith_T...")
Send +^] ; Let VSIDE highlight the string under caret
Sleep, 200 ; Give VAX some response time
Send ( ; This makes VAX surround the string with brackets.
Send {Left} ; Move caret to left side of the just-inserted brackets.
Send _T ; Type in _T
Send {Esc} ; Dismiss VAX's suggestion due to our typing _T above.
}
;==============================================================
; WinDbg 6.3
;==============================================================
windbg_IsActive()
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetClass, class, ahk_id %Awinid%
WinGetTitle, title, ahk_id %Awinid%
if(class=="WinDbgFrameClass")
return true
if(class=="WinBaseClass" && title~="WinDbg:") ; floating inner Command window, WinDbg 10.10240
return true
if(InStr(title, "- WinDbg:6"))
return true
return false
}
#If windbg_IsActive()
F12:: windbg_SendCommentLine()
windbg_SendCommentLine()
{
FormatTime, dtstr, , yyyy-MM-dd HH:mm:ss
; SendInput **★★★★★★★★ %dtstr% ★★★★★★★★**{enter} ; ★ is too small in Win8+ fonts(Consolas etc), damn you M$
SendInput **■■■■■■■■■■■■■■■■■■■■ %dtstr% ■■■■■■■■■■■■■■■■■■■■**{enter}
; memo: * leads a comment line for windbg/kd command
}
^!F12:: windbg_SendQuickCommands()
windbg_SendQuickCommands()
{
SendRaw !sym noisy
Send {Enter}
}
windbg_CommandInput_hctrl(Awinid:=0)
{
if(!Awinid)
WinGet, Awinid, ID, A ; cache active window unique id
; Note: This is rough.
; Only when input focus is on command-input or command-output, command-input is RICHEDIT50W2 ;
; when focus is on some other pane(source window etc), RICHEDIT50W2 is command-output.
; This is tricky, but happened to work most of the time, at least on WinDBG 10.0.10240.
ControlGet, hctrl, HWND, , % "RICHEDIT50W2", ahk_id %Awinid%
return hctrl
}
windbg_CommandOutput_hctrl(Awinid:=0)
{
if(!Awinid)
WinGet, Awinid, ID, A ; cache active window unique id
ControlGet, hctrl, HWND, , % "RICHEDIT50W1", ahk_id %Awinid%
return hctrl
}
windbg_IsCommandInputFocused(Awinid:=0)
{
if(!Awinid)
WinGet, Awinid, ID, A ; cache active window unique id
hCommandInput := windbg_CommandInput_hctrl(Awinid)
ControlGetFocus, classnn_focus, ahk_id %Awinid%
ControlGet, hFocus, HWND, , %classnn_focus% , ahk_id %Awinid%
if(hFocus==hCommandInput)
return true
else
return false
}
windbg_dbglag(text)
{
Amdbg_Lv2("windbg_dbglag", "windbg_dbglag: " text)
}
Enter:: windbg_SendCommandAppendTimestamp()
windbg_SendCommandAppendTimestamp()
{
windbg_dbglag("==========")
WinGet, Awinid, ID, A ; cache active window unique id
hCommandInput := windbg_CommandInput_hctrl(Awinid)
ControlGetFocus, classnn_focus, ahk_id %Awinid%
ControlGet, hFocus, HWND, , %classnn_focus% , ahk_id %Awinid%
if(!windbg_IsCommandInputFocused(Awinid))
{
send {enter}
return
}
; User just pressed enter from the windbg command prompt.
; clipboard_saved := ClipboardAll ; seems not stable
; tooltip, focus=%classnn_focus%
ControlGetText, existing_cmd, , ahk_id %hCommandInput%
if(not existing_cmd) ; command input box is empty
{
; WinDBG's default behavior for an {enter} is to "repeat last command",
; But I think that's stupid behavior. Now I want is:
; Bare typing Enter produce an "empty line" onto output screen, which
; generates visual comfortable context separator for my command groups.
; I achieve this by sending a command with only a space char.
send {space}{enter}
return
}
windbg_dbglag("AAAAA")
; Send current cmd to clipboard, will paste later soon.
WinClip.SetText(existing_cmd)
windbg_dbglag("BBBBB")
SendInput ^{Home}^+{End}{Del}
; using Ctrl+Home, Ctrl+Shift+End so that we can select multiple lines
windbg_dbglag("CCCCC")
windbg_SendCommentLine()
windbg_dbglag("DDDDD")
; wait until clipboard has our text
Loop, 20
{
clipped_text := WinClip.GetText()
;dev_TooltipAutoClear("clippped: " . clipped_text)
if(clipped_text==existing_cmd)
break
windbg_dbglag("ccccc:" A_Index)
Sleep, 50
}
windbg_dbglag("FFFFF")
if(clipped_text!=existing_cmd)
{
MsgBox, % "Windev.ahk: Something went wrong! Your just typed windbg command cannot be fetched from clipboard.`n`n" . existing_cmd
return
}
; ControlSetText, ahk_id %hCommandInput%, % existing_cmd ;
; -- ControlSetText does not work with a RichEdit control, sigh. So we have to rely on clipboard.
SendInput ^v{enter}
windbg_dbglag("GGGGG")
}
windbg_ScrollCommandOutputOnePage(is_up)
{
hCommandOutput := windbg_CommandOutput_hctrl()
; WM_VSCROLL=0x115, SB_PAGEUP=2, SB_PAGEDOWN=3
PostMessage, 0x115 , % is_up?2:3 , 0, , ahk_id %hCommandOutput%
}
PGUP:: windbg_CommandOutput_pgup()
windbg_CommandOutput_pgup()
{
if(windbg_IsCommandInputFocused())
windbg_ScrollCommandOutputOnePage(true)
else
send {pgup}
}
PGDN:: windbg_CommandOutput_pgdn()
windbg_CommandOutput_pgdn()
{
if(windbg_IsCommandInputFocused())
windbg_ScrollCommandOutputOnePage(false)
else
send {pgdn}
}
Ins:: windbg_FocusCommandInput()
windbg_FocusCommandInput()
{
hcmd := windbg_CommandInput_hctrl()
if(hcmd)
ControlFocus, ,ahk_id %hcmd%
}
^d:: windbg_SeeGlobalFlag()
windbg_SeeGlobalFlag()
{
windbg_SendCommentLine()
SendInput, dt ntdll{!}_PEB @$peb NtGlobalFlag{enter}
}
^!1:: send {!}sym noisy
#If ; #If windbg_IsActive()
; ################### VisualGDB ##################
VisualGDBPropertyWindow_IsActive()
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetClass, class, ahk_id %Awinid%
WinGetTitle, title, ahk_id %Awinid%
if( title~="^VisualGDB Project Properties" ) ; ~= means regex match(substring match)
return true
else
return false
}
#If VisualGDBPropertyWindow_IsActive()
^Enter:: ClickInActiveWindow(-204, -32, true) ; Click the OK button
#If ; VisualGDBPropertyWindow_IsActive()
Is_VisualStudioCode()
{
WinGet, Awinid, ID, A ; cache active window unique id
WinGetClass, class, ahk_id %Awinid%
WinGetTitle, title, ahk_id %Awinid%
if( class=="Chrome_WidgetWin_1"
and StrIsEndsWith(title, "Visual Studio Code") )
{
return true
}
else
{
return false
}
}
#If Is_VisualStudioCode()
NumpadDiv:: Send ^{PgUp} ; TabsStudio.Connect.NavigateToPreviousTab
NumpadMult:: Send ^{PgDn} ; TabsStudio.Connect.NavigateToNextTab
#If
; ################ JetBrains IDE #################
;JetBrainsIDE_IsActive()
;{
; WinGet, Awinid, ID, A ; cache active window unique id
; WinGetClass, class, ahk_id %Awinid%
; WinGet, exepath, ProcessPath, ahk_id %Awinid%
;
; if( StrIsEndsWith(exepath, "pycharm64.exe") )
; return true
; else
; return false
;}
;
#If dev_IsExeActive("pycharm64.exe")
NumpadDiv:: Send ^!+{Left} ; Select previous tab
NumpadMult:: Send ^!+{Right} ; Select next tab
#If ;dev_IsExeActive("pycharm64.exe")
;==============================================================
; LINQPad 5 & 6
;==============================================================
#If IsWinTitleMatchRegex("^LINQPad (5|6)")
^p:: Send ^+{space} ; List parameters
^l:: Send ^kl ; List members
^m:: Send ^kl ; List members
NumpadDiv:: Send ^{Pgup} ; Previous Tab
NumpadMult:: Send ^{Pgdn} ; Next Tab
#If
chj_LINQPadInit()
{
QSA_DefineActivateGroupFlex_Caps("l", QSA_NO_WNDCLASS, QSA_NO_WNDCLS_REGEX, "^LINQPad (5|6)", "LINQPad")
}