Four MFDs on a 22 inch Monitor

From OrbiterWiki
Revision as of 11:07, 1 October 2023 by Arvil (talk | contribs) (Added categories.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Copy the below code and paste into your own .ahk file.

SetKeyDelay,10,30

pltMfd1PosX:=5
pltMfd1PosY:=1055
pltMfd1Width:=584        
pltMfd1Height:=520

pltMfd2PosX:=5
pltMfd2PosY:=1580
pltMfd2Width:=584        
pltMfd2Height:=520

pltMfd3PosX:=1091
pltMfd3PosY:=1055
pltMfd3Width:=584
pltMfd3Height:=520

pltMfd4PosX:=1091
pltMfd4PosY:=1580
pltMfd4Width:=584
pltMfd4Height:=520

!i::InitMfds()

;keymapping upper left mfd. !1 = Alt-1, !2 = Alt-2, ...
!1::ClickButton(pltMfd1Handle,"ExtMfd_Button15")    ;left-top button
!2::ClickButton(pltMfd1Handle,"ExtMfd_Button13")
!3::ClickButton(pltMfd1Handle,"ExtMfd_Button11")
!4::ClickButton(pltMfd1Handle,"ExtMfd_Button9")
!5::ClickButton(pltMfd1Handle,"ExtMfd_Button7")
!6::ClickButton(pltMfd1Handle,"ExtMfd_Button5")        ;left-bottom button
!7::ClickButton(pltMfd1Handle,"ExtMfd_Button3")
!8::ClickButton(pltMfd1Handle,"ExtMfd_Button2")        ;menu button
!9::ClickButton(pltMfd1Handle,"ExtMfd_Button1")
!0::ClickButton(pltMfd1Handle,"ExtMfd_Button4")        ;right-bottom button
!q::ClickButton(pltMfd1Handle,"ExtMfd_Button6")
!w::ClickButton(pltMfd1Handle,"ExtMfd_Button8")
!e::ClickButton(pltMfd1Handle,"ExtMfd_Button10")
!r::ClickButton(pltMfd1Handle,"ExtMfd_Button12")    ;right-top button
!t::ClickButton(pltMfd1Handle,"ExtMfd_Button14")

;keymapping lower left mfd. ^!1 = Ctrl-Alt-1, ^!2 = Ctrl-Alt-2, ...
^!1::ClickButton(pltMfd2Handle,"ExtMfd_Button15")    ;left-top button
^!2::ClickButton(pltMfd2Handle,"ExtMfd_Button13")
^!3::ClickButton(pltMfd2Handle,"ExtMfd_Button11")
^!4::ClickButton(pltMfd2Handle,"ExtMfd_Button9")
^!5::ClickButton(pltMfd2Handle,"ExtMfd_Button7")
^!6::ClickButton(pltMfd2Handle,"ExtMfd_Button5")        ;left-bottom button
^!7::ClickButton(pltMfd2Handle,"ExtMfd_Button3")
^!8::ClickButton(pltMfd2Handle,"ExtMfd_Button2")        ;menu button
^!9::ClickButton(pltMfd2Handle,"ExtMfd_Button1")
^!0::ClickButton(pltMfd2Handle,"ExtMfd_Button4")        ;right-bottom button
^!q::ClickButton(pltMfd2Handle,"ExtMfd_Button6")
^!w::ClickButton(pltMfd2Handle,"ExtMfd_Button8")
^!e::ClickButton(pltMfd2Handle,"ExtMfd_Button10")
^!r::ClickButton(pltMfd2Handle,"ExtMfd_Button12")    ;right-top button
^!t::ClickButton(pltMfd2Handle,"ExtMfd_Button14")

;keymapping upper right mfd. +!1 = Shift-Alt-1, +!2 = Shift-Alt-2, ...
+!1::ClickButton(pltMfd3Handle,"ExtMfd_Button15")
+!2::ClickButton(pltMfd3Handle,"ExtMfd_Button13")
+!3::ClickButton(pltMfd3Handle,"ExtMfd_Button11")
+!4::ClickButton(pltMfd3Handle,"ExtMfd_Button9")
+!5::ClickButton(pltMfd3Handle,"ExtMfd_Button7")
+!6::ClickButton(pltMfd3Handle,"ExtMfd_Button5")
+!7::ClickButton(pltMfd3Handle,"ExtMfd_Button3")
+!8::ClickButton(pltMfd3Handle,"ExtMfd_Button2")
+!9::ClickButton(pltMfd3Handle,"ExtMfd_Button1")
+!0::ClickButton(pltMfd3Handle,"ExtMfd_Button4")
+!q::ClickButton(pltMfd3Handle,"ExtMfd_Button6")
+!w::ClickButton(pltMfd3Handle,"ExtMfd_Button8")
+!e::ClickButton(pltMfd3Handle,"ExtMfd_Button10")
+!r::ClickButton(pltMfd3Handle,"ExtMfd_Button12")
+!t::ClickButton(pltMfd3Handle,"ExtMfd_Button14")

;keymapping lower right mfd. ^+!1 = Ctrl-Shift-Alt-1, +!2 = Ctrl-Shift-Alt-2, ...
^+!1::ClickButton(pltMfd4Handle,"ExtMfd_Button15")
^+!2::ClickButton(pltMfd4Handle,"ExtMfd_Button13")
^+!3::ClickButton(pltMfd4Handle,"ExtMfd_Button11")
^+!4::ClickButton(pltMfd4Handle,"ExtMfd_Button9")
^+!5::ClickButton(pltMfd4Handle,"ExtMfd_Button7")
^+!6::ClickButton(pltMfd4Handle,"ExtMfd_Button5")
^+!7::ClickButton(pltMfd4Handle,"ExtMfd_Button3")
^+!8::ClickButton(pltMfd4Handle,"ExtMfd_Button2")
^+!9::ClickButton(pltMfd4Handle,"ExtMfd_Button1")
^+!0::ClickButton(pltMfd4Handle,"ExtMfd_Button4")
^+!q::ClickButton(pltMfd4Handle,"ExtMfd_Button6")
^+!w::ClickButton(pltMfd4Handle,"ExtMfd_Button8")
^+!e::ClickButton(pltMfd4Handle,"ExtMfd_Button10")
^+!r::ClickButton(pltMfd4Handle,"ExtMfd_Button12")
^+!t::ClickButton(pltMfd4Handle,"ExtMfd_Button14")

InitMfds()
{
    global
    WinActivate,Orbiter
    Send ^{F4}
    WinWait, Custom
    Control, ChooseString, External Mfd, ListBox1, Custom
    ControlClick, Button1, Custom
    WinWait,MFD
    WinSetTitle,pltMfd1
    WinMove,pltMfd1,,%pltMfd1PosX%,%pltMfd1PosY%,%pltMfd1Width%,%pltMfd1Height%
    WinGet,pltMfd1Handle,ID,pltMfd1

    WinActivate,Orbiter
    Send ^{F4}
    WinWait, Custom
    Control, ChooseString, External Mfd, ListBox1, Custom
    ControlClick, Button1, Custom
    WinWait,MFD
    WinSetTitle,pltMfd2
    WinMove,pltMfd2,,%pltMfd2PosX%,%pltMfd2PosY%,%pltMfd2Width%,%pltMfd2Height%
    WinGet,pltMfd2Handle,ID,pltMfd2

    WinActivate,Orbiter
    Send ^{F4}
    WinWait, Custom
    Control, ChooseString, External Mfd, ListBox1, Custom
    ControlClick, Button1, Custom
    WinWait,MFD
    WinSetTitle,pltMfd3
    WinMove,pltMfd3,,%pltMfd3PosX%,%pltMfd3PosY%,%pltMfd3Width%,%pltMfd3Height%
    WinGet,pltMfd3Handle,ID,pltMfd3

    WinActivate,Orbiter
    Send ^{F4}
    WinWait, Custom
    Control, ChooseString, External Mfd, ListBox1, Custom
    ControlClick, Button1, Custom
    WinWait,MFD
    WinSetTitle,pltMfd4
    WinMove,pltMfd4,,%pltMfd4PosX%,%pltMfd4PosY%,%pltMfd4Width%,%pltMfd4Height%
    WinGet,pltMfd4Handle,ID,pltMfd4

    WinActivate,Orbiter
    return    
}

ClickButton(mfdHandle,button)
{
    ControlClick,%button%,ahk_id %mfdHandle%
}

See also

Four MFD on 22 inch Monitor [[