It is currently December 2nd, 2022, 10:22 pm

HotKey plugin 1.0

Plugins and Addons popular with the Community
User avatar
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

Re: HotKey plugin 1.0

Post by death.crafter »

balala wrote: October 20th, 2021, 6:11 pm Actually it's not.
Have you tried? Just asking, because if any KeyDownAction option is set explicitly on the measure, it can be easily modified through a !SetOption bang.

Code: Select all

[Rainmeter]
OnRefreshAction=[!SetOption mString SolidColor "FFFFFF"][!SetOption mString LeftMouseUpAction """[!SetOption String String "A"][!Update]"""][!Update]

[String]
Measure=String

[mString]
Meter=String
MeasureName=String
H=20
W=20
balala wrote: October 20th, 2021, 6:11 pm There is no extra measure in my code either. But finally doesn't matter too much. Which solution is preferred by a user depends by more things. I didn't say your solution is not good, there is nothing wrong with it. But when Devo said that:

I came with the !SetOption solution. As usually there are more solutions to the same question. Your is one of them, mine is another. None better, none worse...
I was referring to my previous solution actually when indicating measures.

But you are right, depends on the user. I usually find it complicated to set actions through actions. Sorry for the misunderstanding :D
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 14756
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

death.crafter wrote: October 20th, 2021, 6:23 pm

Code: Select all

[Rainmeter]
OnRefreshAction=[!SetOption mString SolidColor "FFFFFF"][!SetOption mString LeftMouseUpAction """[!SetOption String String "A"][!Update]"""][!Update]

[String]
Measure=String

[mString]
Meter=String
MeasureName=String
H=20
W=20
Not sure what do you want to demonstrate with this code. It doesn't contain a HotKey plugin measure, so what's the point?
Devo
Posts: 8
Joined: May 1st, 2020, 8:17 pm

Re: HotKey plugin 1.0

Post by Devo »

balala wrote: October 20th, 2021, 6:15 pm Obviously you can use any solution you like more, however I'm not entirely sure you didn't miss my post, which explains why my code didn't work.
I was able to get your code working, so thanks for following up. Going back and forth between the codes provided, the both function as intended. While I agree with death.coder that it is a bit more complicated to set actions through actions, it is slightly more configurable by allowing the user to set multiple IfConditions (I think this portion is more logical at least to me). Since I may be adding some additional conditions I think I'll use the code you provided moving forward.

I want to thank both of you though for your help, your different approaches to the logic have helped me with this and will help me with other skins I'm working on as well. Thanks again.
User avatar
balala
Rainmeter Sage
Posts: 14756
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

Devo wrote: October 20th, 2021, 7:31 pm I was able to get your code working, so thanks for following up. Going back and forth between the codes provided, the both function as intended. While I agree with death.coder that it is a bit more complicated to set actions through actions, it is slightly more configurable by allowing the user to set multiple IfConditions (I think this portion is more logical at least to me). Since I may be adding some additional conditions I think I'll use the code you provided moving forward.

I want to thank both of you though for your help, your different approaches to the logic have helped me with this and will help me with other skins I'm working on as well. Thanks again.
I'm glad. Note that as I said previously, there is nothing wrong with none of those codes. Both are (probably) working, even if i didn't tried out death.crafter's (not death.coder's) last code, but I'm sure it is alright. Obviously you can use the one you like more, I can't, but even if I could, I still wouldn't force my code to anyone.
Glad you got it working as expected. :great:
User avatar
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

Re: HotKey plugin 1.0

Post by death.crafter »

balala wrote: October 20th, 2021, 6:40 pm Not sure what do you want to demonstrate with this code. It doesn't contain a HotKey plugin measure, so what's the point?
Don't all sections work similarly?

With the SetOption bang, Dynamicvariables is momentarily forced on the section and the option is set. Also, there is a default value for each option available, so all available options are always there, you define it or not. So, I don't think it matters if it's HotKey plugin or any other measure or meter.

But if you say that it doesn't work like that for HotKey plugin then there is something wrong with it.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 14756
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

death.crafter wrote: October 21st, 2021, 3:34 am With the SetOption bang, Dynamicvariables is momentarily forced on the section and the option is set. Also, there is a default value for each option available, so all available options are always there, you define it or not. So, I don't think it matters if it's HotKey plugin or any other measure or meter.

But if you say that it doesn't work like that for HotKey plugin then there is something wrong with it.
Yep, I know doesn't make too much sense, doesn't for me either. However this is what I found. Additionally as far as I can say, not quite all options have a default value. Otherwise in any other case (on any other type of meter and measure and on any other option) it does work. But still sustain: if the HotKey plugin measure doesn't have an explicitly set a KeyDownAction option, you can't simply set it through a !SetOption bang (well, in fact you can, but won't work). Recommend you to try it out, by seeing my sample code.
User avatar
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

Re: HotKey plugin 1.0

Post by death.crafter »

balala wrote: October 21st, 2021, 7:04 am Yep, I know doesn't make too much sense, doesn't for me either. However this is what I found. Additionally as far as I can say, not quite all options have a default value. Otherwise in any other case (on any other type of meter and measure and on any other option) it does work. But still sustain: if the HotKey plugin measure doesn't have an explicitly set a KeyDownAction option, you can't simply set it through a !SetOption bang (well, in fact you can, but won't work). Recommend you to try it out, by seeing my sample code.
Ahh sorry, I should have tried that before.

May be Brian needs to recheck or explain this behaviour.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 14756
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

death.crafter wrote: October 21st, 2021, 11:03 am Ahh sorry, I should have tried that before.

May be Brian needs to recheck or explain this behaviour.
Agree. Let's see if he'll react. However finally it's not a big deal, but I'd curious about an explanation.
lmiol
Posts: 5
Joined: April 6th, 2022, 5:36 pm

Re: HotKey plugin 1.0

Post by lmiol »

hi guys.
could you help me with some issue?

I have Steam controller (it is a gamepad), which uses keyboard keys + mouse instead of Xinput. It's doing for a reason for desktop controll while user not in a game.

I did big Steam button on desktop for Rainmeter
My controller "A" key is "Enter" keyboard key.
i did this:

Code: Select all

[Variables]
KeyA=0x0D

[Launcher2]
Meter=Image
ImageName=#@#Images\button.png
X=0
Y=3
H=228
W=231
Text=#LinkName#
Measure=Plugin
Plugin=HotKey
HotKey=#KeyA#
KeyDownAction=!Execute [!SetOption #CURRENTSECTION# ImageName "#@#Images\pressed.png"][!UpdateMeter #CURRENTSECTION#][!Redraw]
KeyUpAction=!Execute ["C:\Program Files (x86)\Steam\Steam.exe"]
But ofcourse Rainmeter starts Steam on every press of "A" button of controller.
It is possible to work this only if Main Desktop shows or maybe if mousehover on rainmeter skin?
User avatar
balala
Rainmeter Sage
Posts: 14756
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HotKey plugin 1.0

Post by balala »

lmiol wrote: November 12th, 2022, 9:38 pm But ofcourse Rainmeter starts Steam on every press of "A" button of controller.
It is possible to work this only if Main Desktop shows or maybe if mousehover on rainmeter skin?
To be honest I really doubt this code is working in any way, because the measure name of the HotKey plugin measure is missing (right before the Measure=Plugin option), but there is a Text option, which belongs to String meter, which at least in the posted code snippet doesn't exist. But even if it would exist, the Text option should be added to that meter, not anywhere in the code (for instance between the Image meter and the HotKey plugin measure).
Please double check your code and post it as you have it if it's working, because I assume there is something wrong in this post if the Plugin measure is working.

Additional tip: don't use the !Execute bang, because it has been deprecated long time ago.