#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <Array.au3>

Local $Blink = 1, $sec = @SEC, $LastSec = 0, $AlerterTimer = 25, $c = 0

Local $GUIWidth = 1000, $GUILength = 750
Local $GUIGroupLabelFontSize = $GUIWidth / 71, $GUILabelFontSizeIcon = $GUIWidth / 58, $GUILabelFontSizeSmall = $GUIWidth / 50, $GUILabelFontSizeMid = $GUIWidth / 41.5, $GUILabelFontSizeBig = $GUIWidth / 15.5, $GUILabelFontSizeXL = $GUIWidth / 13.5


$FormMOS = GUICreate("LOD - Main Operation Screen", $GUIWidth, $GUILength, -1, -1,  BitOR($WS_SIZEBOX, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_POPUP), 0)
GUISetBkColor(0x000000)

$GroupHalf1 = GUICtrlCreateGroup("Equalizing Res", 3, 0, $GUIWidth / 6 - 5, $GUILength / 4.6, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupHalf1), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelHalfBig1 = GUICtrlCreateLabel("70", 8, $GUILength / 15, $GUIWidth / 6 - 15, $GUILength / 7, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeBig, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupHalf2 = GUICtrlCreateGroup("Brake Pipe", $GUIWidth / 6 + 3, 0, $GUIWidth / 6 - 5, $GUILength / 4.6, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupHalf2), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelHalfBig2 = GUICtrlCreateLabel("69", $GUIWidth / 6 + 8, $GUILength / 15, $GUIWidth / 6 - 15, $GUILength / 7, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeBig, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupQuarter1 = GUICtrlCreateGroup("Rear", 3, $GUILength / 4.6, $GUIWidth / 12 - 5, $GUILength / 9.5, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupQuarter1), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelQuarter1 = GUICtrlCreateLabel("---", 8, $GUILength / 3.8, $GUIWidth / 12 - 15, $GUILength / 19, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupQuarter2 = GUICtrlCreateGroup("Flow", ($GUIWidth / 12) + 3, $GUILength / 4.6, $GUIWidth / 12 - 5, $GUILength / 9.5, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupQuarter2), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelQuarter2 = GUICtrlCreateLabel("0", ($GUIWidth / 12) + 8, $GUILength / 3.8, $GUIWidth / 12 - 15, $GUILength / 19, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupQuarter3 = GUICtrlCreateGroup("Main", ($GUIWidth / 6) + 3, $GUILength / 4.6, $GUIWidth / 12 - 5, $GUILength / 9.5, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupQuarter3), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelQuarter3 = GUICtrlCreateLabel("137", ($GUIWidth / 6) + 8, $GUILength / 3.8, $GUIWidth / 12 - 15, $GUILength / 19, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupQuarter4 = GUICtrlCreateGroup("BC", ($GUIWidth / 4) + 3, $GUILength / 4.6, $GUIWidth / 12 - 5, $GUILength / 9.5, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupQuarter4), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelQuarter4 = GUICtrlCreateLabel("71", ($GUIWidth / 4) + 8, $GUILength / 3.8, $GUIWidth / 12 - 15, $GUILength / 19, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group1 = GUICtrlCreateGroup("Speedometer", ($GUIWidth / 3) + 3, 0, $GUIWidth / 3 - 5, $GUILength / 4.6, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group1), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelIcon1 = GUICtrlCreateLabel("MPH", $GUIWidth / 1.77, $GUILength / 6.2, $GUIWidth * 24 / 275, $GUILength / 19, $SS_RIGHT)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
$LabelXL1 = GUICtrlCreateLabel("0.0", ($GUIWidth / 3) + 8, $GUILength / 15, $GUIWidth / 4, $GUILength / 7, $SS_RIGHT)
GUICtrlSetFont(-1, $GUILabelFontSizeXL, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupHalf3 = GUICtrlCreateGroup("Accel", ($GUIWidth / 3) + 3, $GUILength / 4.6, $GUIWidth / 6 - 5, $GUILength / 9.5, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupHalf3), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelIcon2 = GUICtrlCreateLabel("MPH min ", $GUIWidth / 2.5, $GUILength / 4.05, $GUIWidth * 24 / 275, $GUILength / 14, $SS_RIGHT)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
$LabelQuarter5 = GUICtrlCreateLabel("0", ($GUIWidth / 3) + 15, $GUILength / 3.8, $GUIWidth / 12 - 15, $GUILength / 19, $SS_RIGHT)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupHalf4 = GUICtrlCreateGroup("Effort", ($GUIWidth / 2) + 3, $GUILength / 4.6, $GUIWidth / 6 - 5, $GUILength / 9.5, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupHalf4), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelIcon3 = GUICtrlCreateLabel("kLb", $GUIWidth / 1.78, $GUILength / 3.63, $GUIWidth * 24 / 275, $GUILength / 25, $SS_RIGHT)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
$LabelQuarter6 = GUICtrlCreateLabel("0", ($GUIWidth / 2) + 15, $GUILength / 3.8, $GUIWidth / 12 - 15, $GUILength / 19, $SS_RIGHT)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup("Unit ID", ($GUIWidth / 1.5) + 3, 0, $GUIWidth / 3 - 5, $GUILength / 9.2, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group2), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$Label1 = GUICtrlCreateLabel("ARR 4004", ($GUIWidth / 1.5) + 8, $GUILength / 22, $GUIWidth / 3 - 15, $GUILength / 19, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupHalf5 = GUICtrlCreateGroup("Distance", $GUIWidth / 1.5 + 3, $GUILength / 9.2, $GUIWidth / 6 - 5, $GUILength / 9.2, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupHalf5), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelHalf5 = GUICtrlCreateLabel("00000", $GUIWidth / 1.5 + 8, $GUILength / 6.5, $GUIWidth / 6 - 15, $GUILength / 19, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupHalf6 = GUICtrlCreateGroup("Reverser", $GUIWidth / 1.2 + 3, $GUILength / 9.2, $GUIWidth / 6 - 5, $GUILength / 9.2, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupHalf6), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelHalf6 = GUICtrlCreateLabel("Center", $GUIWidth / 1.2 + 8, $GUILength / 6.5, $GUIWidth / 6 - 15, $GUILength / 19, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupHalf7 = GUICtrlCreateGroup("Load Meter", $GUIWidth / 1.5 + 3, $GUILength / 4.6, $GUIWidth / 6 - 5, $GUILength / 9.5, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupHalf7), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelHalf7 = GUICtrlCreateLabel("0 A", $GUIWidth / 1.5 + 8, $GUILength / 3.8, $GUIWidth / 6 - 15, $GUILength / 19, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupHalf8 = GUICtrlCreateGroup("Throttle", $GUIWidth / 1.2 + 3, $GUILength / 4.6, $GUIWidth / 6 - 5, $GUILength / 9.5, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupHalf8), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelHalf8 = GUICtrlCreateLabel("Idle", $GUIWidth / 1.2 + 8, $GUILength / 3.8, $GUIWidth / 6 - 15, $GUILength / 19, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x00FF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Line1 = GUICtrlCreateGraphic(0, $GUILength / 3 - 3, $GUIWidth * 2, 2) ;the length don't increment at resizing > x2
GUICtrlSetColor(-1, 0x66FFFF)

$Label2 = GUICtrlCreateLabel("", 0, $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelIcon4 = GUICtrlCreateLabel("WHEEL SLIP", 0, $GUILength / 2.8, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label3 = GUICtrlCreateLabel("", $GUIWidth * 24 / 275, $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFF0000)
$LabelIcon5 = GUICtrlCreateLabel("PCS OPEN", $GUIWidth * 24 / 275, $GUILength / 2.8, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label4 = GUICtrlCreateLabel("", $GUIWidth * 24 / 275 * 2, $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelIcon6 = GUICtrlCreateLabel("SPARE", $GUIWidth * 24 / 275 * 2, $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label5 = GUICtrlCreateLabel("", $GUIWidth * 24 / 275 * 3, $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFF00)
$LabelIcon7 = GUICtrlCreateLabel("DYN BRAKE", $GUIWidth * 24 / 275 * 3, $GUILength / 2.8, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label6 = GUICtrlCreateLabel("", $GUIWidth * 24 / 275 * 4, $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelIcon8 = GUICtrlCreateLabel("HEAD LIGHT", $GUIWidth * 24 / 275 * 4, $GUILength / 2.8, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$GUIAlerterWidth = (($GUIWidth - ($GUIWidth * 24 / 275 * 5) - ($GUIWidth * 24 / 275 * 5)))
$Alerter = GUICtrlCreateLabel("", $GUIWidth * 24 / 275 * 5, $GUILength / 3, $GUIAlerterWidth, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFF0000)
$LabelAlerter = GUICtrlCreateLabel("ALERTER", $GUIWidth * 24 / 275 * 5, $GUILength / 3, $GUIAlerterWidth, $GUILength / 9, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label7 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 5), $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFF00)
$LabelIcon9 = GUICtrlCreateLabel("UNIT ALARM", $GUIWidth - ($GUIWidth * 24 / 275 * 5), $GUILength / 2.8, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label8 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 4), $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFF0000)
$LabelIcon10 = GUICtrlCreateLabel("DOOR OPEN", $GUIWidth - ($GUIWidth * 24 / 275 * 4), $GUILength / 2.8, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label9 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 3), $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFF00)
$LabelIcon11 = GUICtrlCreateLabel("LOW BAT", $GUIWidth - ($GUIWidth * 24 / 275 * 3), $GUILength / 2.8, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label10 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 2), $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFF0000)
$LabelIcon12 = GUICtrlCreateLabel("AB ALARM", $GUIWidth - ($GUIWidth * 24 / 275 * 2), $GUILength / 2.8, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label11 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275), $GUILength / 3, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelIcon13 = GUICtrlCreateLabel("EOT MOVE", $GUIWidth - ($GUIWidth * 24 / 275), $GUILength / 2.8, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Line2 = GUICtrlCreateGraphic(0, $GUILength / 2.22 - 3, $GUIWidth * 2, 2) ;the length don't increment at resizing > x2
GUICtrlSetColor(-1, 0x66FFFF)

$Label12 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 7), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelIcon14 = GUICtrlCreateLabel("SAND", $GUIWidth - ($GUIWidth * 24 / 275 * 7), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label13 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 6), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFF8000)
$LabelIcon15 = GUICtrlCreateLabel("HORN", $GUIWidth - ($GUIWidth * 24 / 275 * 6), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label14 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 5), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFF00)
$LabelIcon16 = GUICtrlCreateLabel("BELL", $GUIWidth - ($GUIWidth * 24 / 275 * 5), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label15 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 4), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0x3399FF)
$LabelIcon17 = GUICtrlCreateLabel("WIN HEAT.", $GUIWidth - ($GUIWidth * 24 / 275 * 4), $GUILength / 2.11, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label16 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 3), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFF0000)
$LabelIcon18 = GUICtrlCreateLabel("HAND BRAKE", $GUIWidth - ($GUIWidth * 24 / 275 * 3), $GUILength / 2.11, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label17 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275 * 2), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0x3399FF)
$LabelIcon19 = GUICtrlCreateLabel("CREW MSG", $GUIWidth - ($GUIWidth * 24 / 275 * 2), $GUILength / 2.11, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$Label18 = GUICtrlCreateLabel("", $GUIWidth - ($GUIWidth * 24 / 275), $GUILength / 2.22, $GUIWidth * 24 / 275, $GUILength / 9)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelIcon20 = GUICtrlCreateLabel("SPARE 1", $GUIWidth - ($GUIWidth * 24 / 275), $GUILength / 2.11, $GUIWidth * 24 / 275, $GUILength / 8, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

$GroupHalf9 = GUICtrlCreateGroup("Time to Penalty", $GUIWidth / 1.2 + 3, $GUILength / 1.76, $GUIWidth / 6 - 5, $GUILength / 11, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupHalf9), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelHalf9= GUICtrlCreateLabel("", $GUIWidth / 1.2 + 8, $GUILength / 1.66, $GUIWidth / 6 - 15, $GUILength / 20, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeMid, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$LabelTime = GUICtrlCreateLabel(@HOUR & ":" & @MIN & ":" & @SEC, $GUIWidth / 40, $GUILength / 1.9, $GUIWidth / 10, $GUILength / 35, $SS_LEFT)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0x66FFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)

$GroupThird1 = GUICtrlCreateGroup("Ind Brk", 3, $GUILength / 1.42, $GUIWidth / 9 - 5, $GUILength / 11, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupThird1), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelThird1= GUICtrlCreateLabel("Lead", 8, $GUILength / 1.345, $GUIWidth / 9 - 15, $GUILength / 22, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeSmall, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupThird2 = GUICtrlCreateGroup("Auto Brk", $GUIWidth / 9 + 3, $GUILength / 1.42, $GUIWidth / 9 - 5, $GUILength / 11, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupThird2), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelThird2= GUICtrlCreateLabel("Freight", $GUIWidth / 9 + 8, $GUILength / 1.345, $GUIWidth / 9 - 15, $GUILength / 22, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeSmall, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupThird3 = GUICtrlCreateGroup("EOT ID", $GUIWidth / 4.5 + 3, $GUILength / 1.42, $GUIWidth / 9 - 5, $GUILength / 11, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupThird3), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelThird3= GUICtrlCreateLabel("17856", $GUIWidth / 4.5 + 8, $GUILength / 1.345, $GUIWidth / 9 - 15, $GUILength / 22, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeSmall, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupThird4 = GUICtrlCreateGroup("EOT Mkr", $GUIWidth / 3 + 3, $GUILength / 1.42, $GUIWidth / 9 - 5, $GUILength / 11, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupThird4), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFF00)
$LabelThird4= GUICtrlCreateLabel("OFF", $GUIWidth / 3 + 8, $GUILength / 1.345, $GUIWidth / 9 - 15, $GUILength / 22, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeSmall, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFF00)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$GroupThird5 = GUICtrlCreateGroup("Fuel", $GUIWidth / 2.25 + 3, $GUILength / 1.42, $GUIWidth / 9 - 5, $GUILength / 11, $BS_CENTER)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($GroupThird5), "wstr", 0, "wstr", 0)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
$LabelThird5= GUICtrlCreateLabel("4256", $GUIWidth / 2.25 + 8, $GUILength / 1.345, $GUIWidth / 9 - 15, $GUILength / 22, $SS_CENTER)
GUICtrlSetFont(-1, $GUILabelFontSizeSmall, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group3 = GUICtrlCreateGroup("", 3, $GUILength / 1.26, $GUIWidth / 1.33, $GUILength / 11)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group3), "wstr", 0, "wstr", 0)
$LabelMessage = GUICtrlCreateLabel("", $GUIWidth / 100, $GUILength / 1.235, $GUIWidth / 1.36, $GUILength / 15, $SS_LEFT)
GUICtrlSetFont(-1, $GUIGroupLabelFontSize, 400, 0, "Arial")
GUICtrlSetColor(-1, 0xFFFFFF)
;GUICtrlSetBkColor(-1, 0xFFFBF0)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Line3 = GUICtrlCreateGraphic(0, $GUILength / 1.12, $GUIWidth * 2, 2) ;the length don't increment at resizing > x2
GUICtrlSetColor(-1, 0x66FFFF)

$Button1 = GUICtrlCreateButton("Air Brake Setup", 3, $GUILength / 1.11, $GUIWidth / 8.5, $GUILength / 11, $BS_MULTILINE)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetResizing(-1, 64)

$Button2 = GUICtrlCreateButton("Distance Setup", $GUIWidth / 8 + 3, $GUILength / 1.11, $GUIWidth / 8.5, $GUILength / 11, $BS_MULTILINE)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetResizing(-1, 64)

$Button3 = GUICtrlCreateButton("EOT Setup", $GUIWidth / 4 + 3, $GUILength / 1.11, $GUIWidth / 8.5, $GUILength / 11, $BS_MULTILINE)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetResizing(-1, 64)

$Button4 = GUICtrlCreateButton("Speed Control", $GUIWidth / 2.67 + 3, $GUILength / 1.11, $GUIWidth / 8.5, $GUILength / 11, $BS_MULTILINE)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetResizing(-1, 64)

$Button5 = GUICtrlCreateButton("", $GUIWidth / 2 + 3, $GUILength / 1.11, $GUIWidth / 8.5, $GUILength / 11, $BS_MULTILINE)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM)
GUICtrlSetState(-1, $GUI_HIDE)

$Button6 = GUICtrlCreateButton("", $GUIWidth / 1.6 + 3, $GUILength / 1.11, $GUIWidth / 8.5, $GUILength / 11, $BS_MULTILINE)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM)
GUICtrlSetState(-1, $GUI_HIDE)

$Button7 = GUICtrlCreateButton("More Options", $GUIWidth / 1.33 + 3, $GUILength / 1.11, $GUIWidth / 8.5, $GUILength / 11, $BS_MULTILINE)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetResizing(-1, 64)

$Button8 = GUICtrlCreateButton("Exit", $GUIWidth / 1.14 + 3, $GUILength / 1.11, $GUIWidth / 8.5, $GUILength / 11, $BS_MULTILINE)
GUICtrlSetFont(-1, $GUILabelFontSizeIcon, 400, 0, "Arial")
GUICtrlSetResizing(-1, 64)


GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_SIZE, WM_SIZE)

GUICtrlSetData($LabelMessage, "Ready")


While 1

    $nMsg = GUIGetMsg()

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            DirRemove(@TempDir & '\ButtonPics\', 1) ;later change to LocalApp
            Exit
        Case $Button8
            DirRemove(@TempDir & '\ButtonPics\', 1) ;later change to LocalApp
            Exit

    EndSwitch


    _BlinkText($Alerter, 0xFF0000)


    If $sec <> $LastSec Then
        $Time = (@HOUR & ":" & @MIN & ":" & @SEC)
        GUICtrlSetData($LabelTime, $Time)
    EndIf


    If $sec <> $LastSec Then
        GUICtrlSetData($LabelHALF9, $AlerterTimer)
        $AlerterTimer = $AlerterTimer - 1
        $LastSec = $sec
        If $AlerterTimer < 0 Then $AlerterTimer = 25
    EndIf

WEnd


Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)

    _WM_SIZE_CALC('$Group', 2, ($GUIWidth / 3 - 5), $GUIGroupLabelFontSize)
    _WM_SIZE_CALC('$Label', 2, ($GUIWidth / 3 - 15), $GUILabelFontSizeMid)
    _WM_SIZE_CALC('$GroupHalf', 9, ($GUIWidth / 6 - 5), $GUIGroupLabelFontSize)
    _WM_SIZE_CALC('$LabelHalf', 9, ($GUIWidth / 6 - 15), $GUILabelFontSizeMid)
    _WM_SIZE_CALC('$LabelHalfBig',2, ($GUIWidth / 6 - 15), $GUILabelFontSizeBig)
    _WM_SIZE_CALC('$GroupQuarter', 4, ($GUIWidth / 12 - 5), $GUIGroupLabelFontSize)
    _WM_SIZE_CALC('$LabelQuarter', 4, ($GUIWidth / 12 - 15), $GUILabelFontSizeMid)
    _WM_SIZE_CALC('$GroupThird', 5, ($GUIWidth / 9 - 5), $GUIGroupLabelFontSize)
    _WM_SIZE_CALC('$LabelThird', 5, ($GUIWidth / 9 - 15), $GUILabelFontSizeSmall)
    _WM_SIZE_CALC('$LabelIcon', 20, ($GUIWidth * 24 / 275), $GUILabelFontSizeIcon)
    _WM_SIZE_CALC('$LabelXL', 1, ($GUIWidth / 4), $GUILabelFontSizeXL)
    _WM_SIZE_CALC('$Button', 8, ($GUIWidth / 8.5), $GUILabelFontSizeIcon)

    $AlerterSize = ControlGetPos($FormMOS, "", $LabelAlerter)
    GUICtrlSetFont($LabelAlerter, $AlerterSize[2] / $GUIAlerterWidth * $GUILabelFontSizeIcon)
    $MessageSize = ControlGetPos($FormMOS, "", $LabelMessage)
    GUICtrlSetFont($LabelMessage, $MessageSize[2] / ($GUIWidth / 1.36) * $GUIGroupLabelFontSize)
    $TimeSize = ControlGetPos($FormMOS, "", $LabelTime)
    GUICtrlSetFont($LabelTime, $TimeSize[2] / ($GUIWidth / 10) * $GUIGroupLabelFontSize)

EndFunc   ;==>_WM_SIZE

Func _WM_SIZE_CALC($szLabelName, $szNumOfLabels, $szLabelWidth, $szFontsize)

    For $l = 1 To $szNumOfLabels
        $szLabel = Execute($szLabelName & $l)
        $aSize = ControlGetPos($FormMOS, "", $szLabel)
        GUICtrlSetFont($szLabel, $aSize[2] / $szLabelWidth * $szFontsize)
    Next

EndFunc   ;==>_WM_SIZE_CALC


Func _BlinkText($BlinkLabel, $BlinkColor)
    If @SEC <> $sec Then
        $sec = @SEC
        If $Blink Then
            GUICtrlSetBkColor($BlinkLabel, 0x000000)
        Else
            GUICtrlSetBkColor($BlinkLabel, $BlinkColor)
        EndIf
        $Blink = Not $Blink
    EndIf
EndFunc   ;==>_BlinkText