Jump to content
Sign in to follow this  
roland_lfor

OpenKneeboard + AutoHotKey => The Winning Couple

Recommended Posts

... to perform all you have dreamed to do from your VR cockpit.

I was looking for such solution since I fly with a VR headset, more than 2 years ago now.

With the fantastic OpenKneeboard free app (I took me some time to understand its power) + a simple AutoHotKey script, I'm able to:

  • Read any set of Pdf documents (native Pdf, not bitmap converted) and navigate inside without latency
  • Display any Desktop App, refreshed in real time
  • Interact with your mouse with the Desktop app you display

All this without leaving the VR cockpit, without performance impact, and with native headset crisp full resolution, like you can see with the OXRTK menu.

Then all our sim apps which are "not VR compliant" are now VR ready

See how you can use Pilot2ATC, Self Loading Cargo, the incoming BeyondATC and more...

20240111.jpg

 

20240114.jpg

 

20240117.jpg

 

20240110.jpg

 

20240112.jpg

  • Like 3
  • Upvote 1

Roland

MSFS my local airport release: LFOR Chartres-Metropole

MSFS Plugins RAAS (registered FSUIPC7 required)

MSFS FX for Objects & Landmark in France (Steam and smoke) and Aerial coverage for French nuclear sites

Share this post


Link to post
Posted (edited)

Here is an AHK script sample for the following scenario: You want to display and interact with Pilot2ATC.

In OKB: You add a "Window capture" tab, and set it to capture Pilot2ATC window.

Let say you want to bind button 6 of your controller #1 to switch the focus as long as you maintain the button down, and get back to MSFS focus when finished:

global appP2A:="ahk_exe Pilot2ATC_2021.exe"
global mfs:="ahk_exe FlightSimulator.exe"

1Joy6::
{
    if not WinExist(appP2A)
        return
	switchApp("1Joy6",appP2A)
}

switchApp(key,app)
{
	OutX:=0
	OutY:=0
	OutWidth:=0
	OutHeight:=0
	SendInput "{Blind}!{Tab}"
	Sleep 100
	WinActivate app
	WinGetClientPos &OutX, &OutY, &OutWidth, &OutHeight
	MouseMove OutWidth/2,OutHeight/2
	KeyWait key
	SendInput "{Blind}!{Tab}"
	WinActivate mfs
}

When you push the button, the mouse is moved to the center of the client app and you can interact with it until you release it. Simple, no?

 

>>> OpenKneeBoard on GitHub

 

 

Edited by roland_lfor
  • Like 1
  • Upvote 1

Roland

MSFS my local airport release: LFOR Chartres-Metropole

MSFS Plugins RAAS (registered FSUIPC7 required)

MSFS FX for Objects & Landmark in France (Steam and smoke) and Aerial coverage for French nuclear sites

Share this post


Link to post

AutoHotKey rules. Been using it for 15+ years. The script I use for control bindings and useful VR functions in MSFS has steadily grown to around 1000 lines of code... And part of it is exactly for interacting with OpenKneeboard and switching input between MSFS and Pilot2ATC like you do.

Share this post


Link to post
On 1/2/2024 at 10:22 PM, roland_lfor said:

Here is an AHK script sample for the following scenario: You want to display and interact with Pilot2ATC.

In OKB: You add a "Window capture" tab, and set it to capture Pilot2ATC window.

Let say you want to bind button 6 of your controller #1 to switch the focus as long as you maintain the button down, and get back to MSFS focus when finished:


global appP2A:="ahk_exe Pilot2ATC_2021.exe"
global mfs:="ahk_exe FlightSimulator.exe"

1Joy6::
{
    if not WinExist(appP2A)
        return
	switchApp("1Joy6",appP2A)
}

switchApp(key,app)
{
	OutX:=0
	OutY:=0
	OutWidth:=0
	OutHeight:=0
	SendInput "{Blind}!{Tab}"
	Sleep 100
	WinActivate app
	WinGetClientPos &OutX, &OutY, &OutWidth, &OutHeight
	MouseMove OutWidth/2,OutHeight/2
	KeyWait key
	SendInput "{Blind}!{Tab}"
	WinActivate mfs
}

When you push the button, the mouse is moved to the center of the client app and you can interact with it until you release it. Simple, no?

 

>>> OpenKneeBoard on GitHub

 

 

Tried running this script but I get an error on line 67 (WinGetClientPos &OutX, &OutY, &OutWidth, &OutHeight) saying that this line contains no recognized action. Any help will be appreciated, thanks!

Share this post


Link to post
19 minutes ago, Divij said:

(WinGetClientPos &OutX, &OutY, &OutWidth, &OutHeight) saying that this line contains no recognized action

Are you running AutoHotKey v2? I would expect you'd get that error in AutoHotKey v1 as WinGetClientPos doesn't exist in v1.

Share this post


Link to post
22 minutes ago, JacquesBrel said:

Are you running AutoHotKey v2? I would expect you'd get that error in AutoHotKey v1 as WinGetClientPos doesn't exist in v1.

Thank you! That was the problem.

Using Navigraph Charts in VR this way feels a lot smoother. 

Out of curiosity, is there a performance hit using Open Kneeboard in VR in MSFS?

Share this post


Link to post

Understood, thanks! This makes using Charts so much faster in VR rather than relying on the airplane EFB.

Is it possible to edit this code for it to work with 2 Programs (Charts +vPilot). So using the same joystick hot key for mouse interaction but for 2 apps depending on which one is in focus in the Kneeboard.

Share this post


Link to post

Got it. So would this edited code work for what I am looking to do?

 

global appP2A:="ahk_exe Navigraph Charts.exe"
global appP3A:="ahk_exe vpilot.exe"
global mfs:="ahk_exe FlightSimulator.exe"

1Joy20::
{
    if not WinExist(appP2A)
        return
    switchApp("1Joy20",appP2A)
}

1Joy5::
{
    if not WinExist(appP3A)
        return
    switchApp("1Joy5",appP3A)
}

switchApp(key,app)
{
    OutX:=0
    OutY:=0
    OutWidth:=0
    OutHeight:=0
    SendInput "{Blind}!{Tab}"
    Sleep 100
    WinActivate app
    WinGetClientPos &OutX, &OutY, &OutWidth, &OutHeight
    MouseMove OutWidth/2,OutHeight/2
    KeyWait key
    SendInput "{Blind}!{Tab}"
    WinActivate mfs
}
 

Apologies for all the trouble but this is truly a gamechanger for me if I can get it to work 🙂

Edited by Divij

Share this post


Link to post

As mentioned there isn't a way that you can get information from OpenKneeboard about which tab is currently open. But you can switch tabs from AutoHotKey using the various RemoteControl-*.exe files in OpenKneeboard: https://openkneeboard.com/features/remote-controls.html#openkneeboard-remotecontrol-set_tabexe - so you could have your script switch to a specific tab and then set mouse focus in the specific app.

If you want one button to do more than one thing, you could use short press/long press, eg. on a short press switch to tab A, on a long press switch to tab B. Code example here: https://www.autohotkey.com/boards/viewtopic.php?t=88662 (v1 script, so it needs to be modified for v2)

Share this post


Link to post

@roland_lfor or someone, great, just seeking this to begin a bit in IVAO again, though in VR, and like many others I found this problem, and if I want the IVAO Pilot Client Altitude in the VR cockpit?, what do I do?

Where those scripts go?

A good manual?, I don´t have tablets installed in the OpenTabletDriver, or what I do?, what a mess, I have the plugin Kneeboard OTD-IPC in it installed, but nothing hahaha

Edited by peloto

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...