Hi all,
I am using RealVNC Viewer on my local Windows machine (the Client) to log into another Windows computer (the Server). I have installed AHK on the Client and on the Server. When using RealVNC Viewer, I'm running it in full screen mode.
What I'd like to achieve is being able to switch between the Client and the Server by clicking the side button of my mouse. Switching from the Client to the Server works fine, using the WinActivate function. But I'm struggling to write some code which successfully gets me from the Server back to the Client by minimising the RealVNC Viewer window. Without AHK there are 2 ways to do this:
First approach is: Press F8 to open the RealVNC context menu in the left top corner of screen, then press "N" to minimise the window.
For some reason sending the F8 key via AHK doesn't work. Either it doesn't send the key or it's not recognised by the RealVNC viewer. Below is the code I used. Any ideas how to fix it?
Code: Select all
;Left side mouse key: Switch to Client by minimising VNC Viewer;My left side mouse button is recognised by Windows as ^#Tab, hence the event trigger below. The trigger itself works fine. I've tested it with MsgBox.^#Tab::Send, {F8}Sleep, 1000Send, {n}MsgBox, "I can see this MsgBox"Return
Second approach is: Move the mouse cursor to the very top of the screen so the RealVNC Viewer floating menu pops down, then click the "Exit full screen" button on that menu.
I tried using the MouseMove and Click functions to replicate the manual way of minising RealVNC Viewer but that didn't work either. The problem is that the screen position that I'd have to hover over is outside of the permitted vertical range, so even the 0 vertical position is not high enough to activate the floating menu.
Code: Select all
;Left side mouse key: Switch to Client by minimising VNC Viewer;My left side mouse button is recognised by Windows as ^#Tab, hence the event trigger below. The trigger itself works fine. I've tested it with MsgBox.^#Tab::CoordMode, Mouse, ScreenMouseMove, 844, 0, 0Sleep, 1000Click, 844, 14Return
Many thanks in advance for your suggestions.