So here is my attempt how to simulate opening drop down menu (listing open programs) in two windows, such as here in the picture (red boxes😞 Code explained: 1) The dropdowns are located on the upper bars. Click somewhere on the upper bar and retrieve the ClassNN of these bars via MouseGetPos. 1) Get the coords of the upper left corner of the control (see the green X in the picture above). 2) Offset a little bit from the corners so the cursor is in the middle of the dropdown. 3) Click twice, with 250ms in between clicks (one click is not enough for some reason). Note: ControlClick does not work. Change the delay if needed. 4) Move cursor back where it was originally. 5) Hotkeys Alt+Left or Alt+Right to show dropdown menu in the left or right window. ConGetPos(RightQ)
{
;get control ClassNN of the upper bars where the dropdowns are located
LeftBoxX = 350 ;approx location of the left bar
LeftBoxY = 75
RightBoxX = 1350 ;approx location of the right bar
RightBoxY = 75
SetMouseDelay, 0
MouseGetPos, CurrX, CurrY
if (RightQ = 0)
{
MouseMove, %LeftBoxX%, %LeftBoxY%
MouseGetPos, , , , ClassAtPos
}
if (RightQ = 1)
{
MouseMove, %RightBoxX%, %RightBoxY%
MouseGetPos, , , , ClassAtPos
}
ControlGetPos, xCon, yCon, ,, %ClassAtPos%
xShifted:=xCon+15
yShifted:=yCon+15 Click, %xShifted% %yShifted%
sleep 250
Click, %xShifted% %yShifted%
MouseMove, %CurrX%, %CurrY%
}
!Left::ConGetPos(0)
!Right::ConGetPos(1) EDIT: First version of the code was very unstable (the ClassNN of the upper bars changes often and cannot be hardcoded). ADDED 2018-07-03: Toggle between the right and left editor windows If you have an older version of SAS EG (V7.12 in my case), the command F6 might not work. Here is autohotkey workaround (keyboard shortcut RightShift+Tab): ; toggle between the right and left editor windows
; Right Shift+Tab
RShift & Tab::
;get control ClassNN of the left and right editor
; first let's find
LeftEditorX = 350 ;approx location of the left editor window
LeftEditorY = 400
RightEditorX = 1350 ;approx location of the right editor window
RightEditorY = 400
SetMouseDelay, 0
;save current coords
MouseGetPos, CurrX, CurrY
; pos of the left editor
MouseMove, %LeftEditorX%, %LeftEditorY%
MouseGetPos, , , , ClassAtPosLeft
; pos of the right editor
MouseMove, %RightEditorX%, %RightEditorY%
MouseGetPos, , , , ClassAtPosRight
; what is the class under the caret?
MouseMove, %A_CaretX%, %A_CaretY%
MouseGetPos, , , , CurrentCaretClass
;toggle
if (CurrentCaretClass = ClassAtPosLeft)
ControlFocus, %ClassAtPosRight%
else
ControlFocus, %ClassAtPosLeft%
MouseMove, %CurrX%, %CurrY%
return
... View more