I'm currently making my very first rainmeter skin and I'm having some troubles with the code:
The skin is a simple kill switch, as in a flip switch with a cover, as typically seen in (military) aircraft. To work properly this switch needs to have a couple states:
1. Closed: In this case hovering over should open the hood, but not actuate the switch. If the mouse stops hovering over the skin the hood should close again
2. Pressed: If the switch is clicked (while being hovered) the switch should.. well switch and stay in that state (Meaning state 1 is no longer in effect). Also some executables shall be executed.
3. Closing: If the switch is activated again by clicking it, the hood should slam down, disabling the switch again and resetting everything.
Visually these three states are distinguished by three renders of a switch i modeled. Since I'm unfortunately quite daft if it comes to coding, this is my current progress:
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
[Variables]
Path = PATH
ImageOn = #Path#\On.png
ImageOff = #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 = 1
DynamicVariables=1
[MeterBackground]
Pressed = 1
Meter = Image
ImageName = #ImageClosed#
W = 250
H = 250
GreyScale = 0
ImageTint = 255,255,255,255
###Open and Close when the mouse hovers over
MouseOverAction = !Execute [Play "#SoundOpen#"][!SetOption #CURRENTSECTION# ImageName "#ImageOff#"][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction = !Execute [Play "#SoundHoodClose#"][!SetOption #CURRENTSECTION# ImageName "#ImageClosed#"][!UpdateMeter #CURRENTSECTION#][!Redraw]
###Switch the switch and execute the executables
LeftMouseDownAction = !Execute [!SetVariable Pressed = "1"][Play "#SoundSwitch#"]["DIFFERENT PATH"]["DIFFERENT PATH"]["DIFFERENT PATH"]["WINDOWS SETTINGS][!SetOption #CURRENTSECTION# ImageName="#ImageOn#"][!UpdateMeter #CURRENTSECTION#][!Redraw]
###Close the switch, resetting everything
LeftMouseDownAction = !Execute [!SetVariable Pressed = "0"][Play "#SoundClose#"][!SetOption #CURRENTSECTION# ImageName="#ImageClosed#"][!UpdateMeter #CURRENTSECTION#][!Redraw]
What does work? The state number 1 works 100%, the state number 2 does work in that it executes the programs. Sadly it does not change the image and there is no "latching" of the switch. State 3 does not work at all, since I can't really progress on that front as long as number 2 is not figured out.
I've tried implementing an if statement in various ways, sadly none of that's working.
That's it. I hope the solution isn't too too obvious
Greetings and many thanks,
Herr KaLeun