Thank you very much to eclectic_tech for the great help!
The finished code in all of it's glory:
Code: Select all
[Metadata]
Name=DCS Set Up
Author=Herr_KaLeun
Information=Stuff
Version=0.1 20191209
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0
; Thanks to the kind people of the rainmeter forums and especially eclectic_tech for the help in creating this.
[Variables]
; Path to all of the recources
Path=G:\Dropbox\Dropbox\Dropbox\Bilder\Rainmeter_DCS\
Image1=#Path#\On.png
Image0=#Path#\Off.png
ImageClosed=#Path#\Closed.png
SoundOpen=#Path#\Open.wav
SoundClose=#Path#\Close.wav
SoundSwitch=#Path#\On.wav
SoundHoodClose=#Path#\HoodClose.wav
; Dynamic Variable to check whether it was clicked
Pressed=0
; Dynamic Variable to check wehter the hood is open
Open=0
[MeterKillSwitch]
DynamicVariables=1
Meter=Image
ImageName=#ImageClosed#
W=300
H=300
ImageTint=255,255,255,255
; Open and Close when the mouse hovers over
MouseOverAction=[Play "#SoundOpen#"][!SetOption #CURRENTSECTION# ImageName "#Image0#"][!UpdateMeter #CURRENTSECTION#][!SetVariable Open "1"][!Redraw][!UpdateMeasure mOpen]
MouseLeaveAction=[Play "#SoundHoodClose#"][!SetOption #CURRENTSECTION# ImageName "#ImageClosed#"][!UpdateMeter #CURRENTSECTION#][!SetVariable Open "0"][!Redraw][!UpdateMeasure mOpen]
; Switch the switch and execute the executables
LeftMouseDownAction=[!SetVariable Pressed "1"][Play "#SoundSwitch#"]["G:\Programme\VoiceAttack\VoiceAttack.exe"]["C:\Program Files\Logitech\X52\ST.exe"]["G:\Programme\TrackIR\TrackIR5.exe"]["%windir%\System32\cmd.exe" /c start joy.cpl][!SetOption #CURRENTSECTION# ImageName "[#Image[#Pressed]]"][!UpdateMeter #CURRENTSECTION#][!Redraw][!UpdateMeasure mPressed]["G:\Programme\DCS-SimpleRadio-Standalone\SR-ClientRadio.exe"]
LeftMouseDoubleClickAction=[!SetVariable Pressed "0"][!SetVariable Open "0"][Play "#SoundClose#"][!SetOption #CURRENTSECTION# ImageName "[#ImageClosed]"][!UpdateMeter #CURRENTSECTION#][!Redraw][!UpdateMeasure mPressed][!UpdateMeasure mOpen]
[mPressed]
DynamicVariables=1
Measure=Calc
Formula=#Pressed#
IfCondition=(#Pressed#=0)
; Actions to happen when switch is SAFE
IfTrueAction=[!EnableMouseAction MeterKillSwitch "MouseOverAction|MouseLeaveAction|LeftMouseDownAction"][!DisableMouseAction MeterKillSwitch "LeftMouseDoubleClickAction"][!Log "Actions performed!"]
; Actions to happen when switch is ARM
IfFalseAction=[!DisableMouseAction MeterKillSwitch "MouseOverAction|MouseLeaveAction|LeftMouseDownAction"][!EnableMouseAction MeterKillSwitch "LeftMouseDoubleClickAction"][!Log "NO Actions performed!"]
; Do not update until told to do so by !UpdateMeasure bang
UpdateDivider=-1
[mOpen]
DynamicVariables=1
Measure=Calc
Formula=#Open#
IfCondition=(#Open#=0)
; Actions to happen when hood is closed
IfTrueAction=[!DisableMouseAction MeterKillSwitch "MouseLeaveAction"]
; Actions to happen when hood is open
IfFalseAction=[!EnableMouseAction MeterKillSwitch "MouseLeaveAction"]
; Do not update until told to do so by !UpdateMeasure bang
UpdateDivider=-1