It is currently October 18th, 2019, 7:09 am

Hotkey Plugin help

Help with creating, editing & fixing problems with skins
Nilvarno
Posts: 18
Joined: March 24th, 2019, 5:52 pm

Hotkey Plugin help

Nilvarno » March 24th, 2019, 6:04 pm

hello, i'm making a menu-like skin and i'd like to turn it on and off with a keyboard key combination. I read that the plugin "Hotkey" is the one i need to do it, but it's the first time i use a plugin and i'm not understanding how it works, don't even know where to start.

Code: Select all

[Base]
Meter=image
ImageName=Ancora.jpg
X=2500
Y=1400
w=50
h=50
LeftMouseUpAction=[!RainmeterToggleMeterGroup Skin][!RainmeterHideMeterGroup Game1][!RainmeterHideMeterGroup Game2][!RainmeterHideMeterGroup Game3][!RainmeterHideMeterGroup Multy1][!RainmeterHideMeterGroup Emu1]
This is the code i'm temporary using to turn on and off the menu by clicking a little skin on the desktop, i'd like to erase this entirely, so the skin is totally hidden, thank you.
User avatar
balala
Rainmeter Sage
Posts: 8852
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Hotkey Plugin help

balala » March 24th, 2019, 7:02 pm

What would you like? To hide / show the whole skin when you're hitting certain key on your keyboard? This is what I understood from your description.
If this is right, here is what to do: add the following measure to your code:

Code: Select all

[MeasureToggle]
Measure=Plugin
Plugin=HotKey
HotKey=CTRL F1
KeyDownAction=[!ToggleFade]
This measure will toggle the skin whenever you are hitting the CTRL - F1 key combination.
Obviously this is just an example, other key combinations can be used as well. In the README.md file contained in the package which can be downloaded through the "pre-defined keywords" link here, you have a list of the possible key combinations.
Please let me know if not this is what you intended.

Tip: !Rainmeter... is a deprecated bang prefix and you should have to avoid using it. For example instead of the posted [!RainmeterToggleMeterGroup Skin] bang use [!ToggleMeterGroup Skin].
Nilvarno
Posts: 18
Joined: March 24th, 2019, 5:52 pm

Re: Hotkey Plugin help

Nilvarno » March 24th, 2019, 7:26 pm

First thing, thank you a lot for answering, second, yes you understood well, i want to show/hide the skin, and i made what you said and hotkey works, but still i have problems:

Code: Select all

[MeasureToggle]
Measure=Plugin
Plugin=HotKey
HotKey=NUM0
KeyDownAction=[!ToggleFade]

[Base]
Meter=image
ImageName=Ancora.jpg
X=2500
Y=1400
w=50
h=50
LeftMouseUpAction=[!ToggleMeterGroup Skin][!HideMeterGroup Game1][!HideMeterGroup Game2][!HideMeterGroup Game3][!HideMeterGroup Multy1][!HideMeterGroup Emu1]

[Background]
Meter=image
ImageName=Background.png
X=0
Y=0
w=2049
h=1120
Hidden=1
Group=Skin

[Button0]
Meter=image
ImageName=ButtonX.png
X=80
Y=408
w=20
h=310
LeftMouseDownAction=[!HideMeterGroup Game1][!HideMeterGroup Game2][!HideMeterGroup Game3][!HideMeterGroup Multy1][!HideMeterGroup Emu1]
Hidden=1
Group=Skin


[Button1]
Meter=image
ImageName=Button.png
X=14
Y=20
w=60
h=60
LeftMouseDownAction=[!ShowMeterGroup Game1][!HideMeterGroup Game2][!HideMeterGroup Game3][!HideMeterGroup Multy1][!HideMeterGroup Emu1]
Hidden=1
Group=Skin

[Button2]
Meter=image
ImageName=Button.png
X=14
Y=80
w=60
h=60
LeftMouseDownAction=[!ShowMeterGroup Game2][!HideMeterGroup Game1][!HideMeterGroup Game3][!HideMeterGroup Multy1][!HideMeterGroup Emu1]
Hidden=1
Group=Skin

[Button3]
Meter=image
ImageName=Button.png
X=14
Y=140
w=60
h=60
LeftMouseDownAction=[!ShowMeterGroup Game3][!HideMeterGroup Game1][!HideMeterGroup Game2][!HideMeterGroup Multy1][!HideMeterGroup Emu1]
Hidden=1
Group=Skin

[ButtonMulty1]
Meter=image
ImageName=ButtonMulty1.png
X=14
Y=740
w=60
h=60
LeftMouseDownAction=[!ShowMeterGroup Multy1][!HideMeterGroup Game1][!HideMeterGroup Game2][!HideMeterGroup Game3][!HideMeterGroup Emu1]
Hidden=1
Group=Skin

[ButtonEmu1]
Meter=image
ImageName=ButtonEmu1.png
X=14
Y=980
w=60
h=60
LeftMouseDownAction=[!ShowMeterGroup Emu1][!HideMeterGroup Game1][!HideMeterGroup Game2][!HideMeterGroup Game3][!HideMeterGroup Multy1]
Hidden=1
Group=Skin
This is the code i'm using, as you can see, i'm using "BASE" as a displayed button to show/hide the menu formed by the Groups "Skin", but the code you gave me, placed at the start, makes show/hide the "BASE" button, not the menu, and i don't get what i'm doing wrong. Basically, the hotkey thing shall hide/show the Skin group, just like the "BASE" button does, thank you again.

Edit: i tried setting Hidden to 0 and it works fine, but like this when i start windows the skin is on, while i want it hidden from the start :???:
User avatar
balala
Rainmeter Sage
Posts: 8852
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Hotkey Plugin help

balala » March 24th, 2019, 7:50 pm

Nilvarno wrote:
March 24th, 2019, 7:26 pm
This is the code i'm using, as you can see, i'm using "BASE" as a displayed button to show/hide the menu formed by the Groups "Skin", but the code you gave me, placed at the start, makes show/hide the "BASE" button, not the menu, and i don't get what i'm doing wrong. Basically, the hotkey thing shall hide/show the Skin group, just like the "BASE" button does, thank you again.
Let's get it step by step. We'll start with hiding / showing the skin.
If you hide the skin, it is completely hidden, no meters of it will be seen. So, I think you shouldn't have to completely hide the skin itself, just the appropriate meters. So, replace the KeyDownAction option of the [MeasureToggle] measure with the following one: KeyDownAction=[!ToggleMeterGroup "Skin"][!HideMeterGroup "Game1"][!HideMeterGroup "Game2"][!HideMeterGroup "Game3"][!HideMeterGroup "Multy1"][!HideMeterGroup "Emu1"].
Nilvarno wrote:
March 24th, 2019, 7:26 pm
Edit: i tried setting Hidden to 0 and it works like this, but like this, when i start windows the skin is on, while i want it hidden from the start :???:
If you got this (let me know if there still are some problems), related to the posted Edit, what would you like? At start to get the skin hidden? Not sure, some details would be great.
Nilvarno
Posts: 18
Joined: March 24th, 2019, 5:52 pm

Re: Hotkey Plugin help

Nilvarno » March 24th, 2019, 8:19 pm

Thank you very much! Now everything works perfectly, yes i wanted the skin to start hidden and then toggle it with the button combination, i'm sorry if i didn't explain myself very well, glad you got it anyway :givelove:
User avatar
balala
Rainmeter Sage
Posts: 8852
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Hotkey Plugin help

balala » March 24th, 2019, 8:26 pm

Nilvarno wrote:
March 24th, 2019, 8:19 pm
yes i wanted the skin to start hidden and then toggle it with the button combination,
You wanted the skin to start hidden, or the menu? Not the same thing.
Nilvarno
Posts: 18
Joined: March 24th, 2019, 5:52 pm

Re: Hotkey Plugin help

Nilvarno » March 24th, 2019, 8:37 pm

Oh i got that now, in my mind they were the same. I wanted the menu to start hidden. The last code you gave me worked perfectly once i sat the menu parts to hidden=1
User avatar
balala
Rainmeter Sage
Posts: 8852
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Hotkey Plugin help

balala » March 24th, 2019, 9:16 pm

Nilvarno wrote:
March 24th, 2019, 8:37 pm
Oh i got that now, in my mind they were the same. I wanted the menu to start hidden. The last code you gave me worked perfectly once i sat the menu parts to hidden=1
There is one more possibility, which usually I prefer much more than toggling (or showing / hiding) the meters. Here is a short description of this method, if you want to give it a try.
First you need a variable, which will control when the meters belonging to the menu will be shown. Let's name this variable Menu. Declare it in the [Variables] section (so, add a such section - usually at the beginning of the code, but finally you can add it anywhere):

Code: Select all

[Variables]
Menu=0
Now we'll need a measure which will control when what is visible and what is hidden. Add it as well:

Code: Select all

[MeasureMenu]
Measure=Calc
Formula=#Menu#
IfCondition=(#CURRENTSECTION#>=1)
IfTrueAction=[!ShowMeterGroup "Skin"][!HideMeterGroup "Game1"][!HideMeterGroup "Game2"][!HideMeterGroup "Game3"][!HideMeterGroup "Multy1"][!HideMeterGroup "Emu1"][!Redraw]
IfFalseAction=[!HideMeterGroup "Skin"][!HideMeterGroup "Game1"][!HideMeterGroup "Game2"][!HideMeterGroup "Game3"][!HideMeterGroup "Multy1"][!HideMeterGroup "Emu1"][!Redraw]
DynamicVariables=1
Whenever the value of the Menu variable is toggling between 0 and 1, the menu will be hidden / shown.
You have to modify the KeyDownAction option of the [MeasureToggle] measure, to get the value of the Menu variable toggled between the two needed values. Because the Menu variable is changing dynamically whenever you hitting the appropriate key or you click, a DynamicVariables=1 option will also have to be added to the [MeasureToggle] measure. Don't forget it. The measure will look like:

Code: Select all

[MeasureToggle]
Measure=Plugin
Plugin=HotKey
HotKey=NUM0
KeyDownAction=[!SetVariable Menu "(1-#Menu#)"][!UpdateMeasure "#CURRENTSECTION#"][!UpdateMeasure "MeasureMenu"][!UpdateMeter "Base"]
DynamicVariables=1
Finally you also have to modify the LeftMouseUpAction option of the [Base] meter and as explained above, also have to add a DynamicVariables=1 option:

Code: Select all

[Base]
Meter=image
SolidColor=255,0,0
X=0
Y=0
w=50
h=50
LeftMouseUpAction=[!SetVariable Menu "(1-#Menu#)"][!UpdateMeasure "MeasureToggle"][!UpdateMeasure "MeasureMenu"][!UpdateMeter "Base"]
DynamicVariables=1
This procedure has a great advantage: there is extremely easy to control if the meters are shown or hidden on refresh (or load). You simply just have to change the value of the Menu variable within the [Variables] section. Also there is no need to add any Hidden=1 option, because the visibility of the meters is controlled by the [MeasureMenu] measure.
If you give a try and have questions, please feel free to come back.
Nilvarno
Posts: 18
Joined: March 24th, 2019, 5:52 pm

Re: Hotkey Plugin help

Nilvarno » March 24th, 2019, 10:07 pm

thanks again, i'll give it a try. to me this is a level far beyond my knowledge, but thanks for the explanation, i'll try to understand it :thumbup:
User avatar
qwerky
Posts: 182
Joined: April 10th, 2014, 12:31 am
Location: Canada

Re: Hotkey Plugin help

qwerky » March 24th, 2019, 10:17 pm

balala wrote:
March 24th, 2019, 9:16 pm
Finally you also have to modify the LeftMouseUpAction option of the [Base] meter and as explained above, also have to add a DynamicVariables=1 option:

Code: Select all

[Base]
Meter=image
SolidColor=255,0,0
X=0
Y=0
w=50
h=50
LeftMouseUpAction=[!SetVariable Menu "(1-#Menu#)"][!UpdateMeasure "#CURRENTSECTION#"][!UpdateMeasure "MeasureMenu"][!UpdateMeter "Base"]
DynamicVariables=1
This procedure has a great advantage: there is extremely easy to control if the meters are shown or hidden on refresh (or load). You simply just have to change the value of the Menu variable within the [Variables] section. Also there is no need to add any Hidden=1 option, because the visibility of the meters is controlled by the [MeasureMenu] measure.
If you give a try and have questions, please feel free to come back.
Hi balala, I'm not the OP, but I do have a question; is that okay? :lol:

In the LeftMouseUpAction of Meter Base, you have an [!UpdateMeasure "#CURRENTSECTION#"]. Should that be [!UpdateMeter "#CURRENTSECTION#"]? If so, would that not obviate the need for the final [!UpdateMeter "Base"]? Or if not, then what does [!UpdateMeasure "#CURRENTSECTION#"] refer to when used in a meter? :Whistle