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
There isn't a direct key for this. Use Shift+F6 to navigate among the main panes of your workspace, then arrow/Enter to select content in there (like programs from a list in your project tree). You might be able to come up with an AutoHotkey script that does this for you.
Can you tell us what version of EG you're using? Shift+F6 works for me with v7.15.
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
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.