Four MFD on 22 inch Monitor

From OrbiterWiki
Jump to navigation Jump to search

This Script will display 4 ExtMFD instances in each corner of a 1680 x 1050 display. The display is configured left of the main screen. You can use WindowSpy that comes with Autohotkey to locate different positions and sizes for other monitor configurations.

This script is based on a two MFD version that was posted to the M6 forum.

SetKeyDelay,10,30

pltMfd1PosX:=-1675
pltMfd1PosY:=5
pltMfd1Width:=584        
pltMfd1Height:=520

pltMfd2PosX:=-1675
pltMfd2PosY:=530
pltMfd2Width:=584        
pltMfd2Height:=520

pltMfd3PosX:=-589
pltMfd3PosY:=5
pltMfd3Width:=584
pltMfd3Height:=520

pltMfd4PosX:=-589
pltMfd4PosY:=530
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%
}