It is currently April 25th, 2024, 1:28 am

How to Utilize a skin button as a hotkey

Get help with creating, editing & fixing problems with skins
Tazdude24
Posts: 5
Joined: July 29th, 2020, 1:13 am

How to Utilize a skin button as a hotkey

Post by Tazdude24 »

Hello!

I just discovered Rainmeter and I freagin love it. I am currently using the Jarvis/Iron Man Skin and there is a Jarvis Meter that I thought I could easily enough provide button functionality, but I am unsure of how to have it act as a hotkey upon pressing.

Basically, I have the Alexa app which uses the shortcut: Ctrl + Shift + A to wake it up, and I would like to apply that shortcut to the Jarvis Button.

I essentially just grabbed the code below from another button being used in the skin, placed it in the Jarvis .ini file hoping to replace the Rotator with the Button code, but I can not get it to simulate the above shortcut.

Code: Select all

[MeterButton]
Meter=BUTTON
ButtonImage=sJARVIS.png
ButtonCommand=!Execute ["%UserProfile%"]   < Replace this with some kind of keypress function?
Antialias=1
The full Jarvis .ini code is below, with the change I'd like to make being at block 35-43 and turning that into a button?
Thanks in advance for any help!

Code: Select all

[Rainmeter]
Update=50
DynamicWindowSize=1

[Variables]
ImageW=370
ImageH=370

[MeasureRotate]
Measure=Calc
Formula=(MeasureRotate % 360) + 1
MaxValue=360


[MeterRotate3]
Meter=Rotator
MeasureName=MeasureRotate
ImageName=sCORE.png
RotationAngle=10
OffsetX=(#ImageW# / 2)
OffsetY=(#ImageH# / 2)
W=#ImageW#
H=#ImageH#

[MeterRotate4]
Meter=Rotator
MeasureName=MeasureRotate
ImageName=sCRPT.png
RotationAngle=-10
OffsetX=(#ImageW# / 2)
OffsetY=(#ImageH# / 2)
W=#ImageW#
H=#ImageH#

[MeterRotate6]
Meter=Rotator
MeasureName=MeasureRotate
ImageName=sJARVIS.png
RotationAngle=0
OffsetX=(#ImageW# / 2)
OffsetY=(#ImageH# / 2)
W=#ImageW#
H=#ImageH#

[MeterRotate7]
Meter=Rotator
MeasureName=MeasureRotate
ImageName=sO_RNG.png
RotationAngle=5
OffsetX=(#ImageW# /2 )
OffsetY=(#ImageH# / 2)
W=#ImageW#
H=#ImageH#

[ImageMeter]
Meter=Image
ImageName=[ImageNumberCalc].png
DynamicVariables=1
ImageTint=#ColorStyle#
OffsetX=(#ImageW# /2)
OffsetY=(#ImageH# /s)

[ImageNumberCalc]
Measure=Calc
Formula=Counter % 30


User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: How to Utilize a skin button as a hotkey

Post by Mor3bane »

It is possible that once identified with a location for the button, that image or location can have a mouse action treat it as a clickable object. Then simply do the following:

Code: Select all

LeftMouseUpAction=["PathToYourApp\AppNameExe"]
This works for most programs, such as one that is 'sleeping', then opening it on mouse action.

There are a few: https://docs.rainmeter.net/manual/mouse-actions/
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to Utilize a skin button as a hotkey

Post by balala »

Tazdude24 wrote: July 29th, 2020, 1:32 am Basically, I have the Alexa app which uses the shortcut: Ctrl + Shift + A to wake it up, and I would like to apply that shortcut to the Jarvis Button.

I essentially just grabbed the code below from another button being used in the skin, placed it in the Jarvis .ini file hoping to replace the Rotator with the Button code, but I can not get it to simulate the above shortcut.
In addition to Mor3bane's reply, you have to know that you need to install the HotKey plugin, in order to can get an action when hitting a hotkey. If interested, here is what you have to do:
First install the plugin. To do this, download and run the HotKey_1.0.0.12.rmskin skin installer from the link above. If you do this, you'll get installed a new skin (named HotKey) and a HotKey.dll plugin, which we gonna use. We won't use the newly installed HotKey skin, so you can remove it from your Skins folder. But maybe it worth to take a look, to study the code a little bit, to deeper understand how the plugin does work.
If you have installed the plugin, you can start using it. For first add the following measure to your code:

Code: Select all

[MeasureMoveLeft]
Measure=Plugin
Plugin=HotKey
HotKey=CTRL SHIFT A
KeyDownAction=
DynamicVariables=1
With this measure, you don't need a Button (or any other kind of) meter to execute the action. Add the appropriate action to the above KeyDownAction option (sorry, but unfortunately I couldn't figure out what has to be done) and when you did this, you'll get the action executed whenever are you hitting the three keys.
Hope I didn't misunderstand you. Sorry if I did...
Tazdude24
Posts: 5
Joined: July 29th, 2020, 1:13 am

Re: How to Utilize a skin button as a hotkey

Post by Tazdude24 »

Thanks for your replies!!

To get a better understanding of what I am trying to do, here is the current skin I am using:
https://www.deviantart.com/edreyes/art/JARVIS-SHIELD-Interface-Rainmeter-Theme-310689538

It already utilizes buttons to open programs, folders and links, so that is all great.

What I am trying to do is the following:

Click or Touch Jarvis Icon
>>This action then somehow simulates the hotkey function of Ctrl + Shift + A to activate Alexa.

The idea to open the .exe program is great, but in this case the the program is actually already on, I just want to activate this very specific function with a button press - instead of the hotkey.

Thanks again for you feedback!
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to Utilize a skin button as a hotkey

Post by jsmorley »

I think you will need some external utility like nircmd or AutoHotKey or AutoIt to accomplish this. The HotKey plugin by Brian won't work for this, as it is not the intent of that plugin to simulate keystrokes, what is commonly known as "key faking", but rather to react to actual keystrokes and take some action.

You will need to call some external utility that can in fact simulate keystrokes. The simplest is probably nircmd.

https://www.nirsoft.net/utils/nircmd.html
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to Utilize a skin button as a hotkey

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeterSettings]
Meter=String
FontSize=20
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Open Settings
LeftMouseUpAction=["#@#nircmd\nircmd.exe" sendkeypress lwin+i]
This assumes you have put the nircmd.exe program in the @Resources folder of your skin, in a sub-folder called nircmd\. Nothing says it has to be there, although I recommend it, just specify the correct location when you call the .exe in the bang.
Tazdude24
Posts: 5
Joined: July 29th, 2020, 1:13 am

Re: How to Utilize a skin button as a hotkey

Post by Tazdude24 »

This worked perfectly! Thanks so much!

This was exactly what I was hoping for, and will make the whole "Jarvis" simulation as close as I can get it for now. :D

THANKS EVERYONE, I appreciate the time you took with this!

-Jamie
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to Utilize a skin button as a hotkey

Post by balala »

Tazdude24 wrote: July 29th, 2020, 2:47 pm To get a better understanding of what I am trying to do, here is the current skin I am using:
https://www.deviantart.com/edreyes/art/JARVIS-SHIELD-Interface-Rainmeter-Theme-310689538
This is not a skin. It's an image, isn't it?
Tazdude24
Posts: 5
Joined: July 29th, 2020, 1:13 am

Re: How to Utilize a skin button as a hotkey

Post by Tazdude24 »

The Ironman art is specifically just an image, but everything else is a part of the skin, kind of works around the Ironman background
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: How to Utilize a skin button as a hotkey

Post by Mor3bane »

Tazdude24 wrote: July 29th, 2020, 3:41 pm This worked perfectly! Thanks so much!

This was exactly what I was hoping for, and will make the whole "Jarvis" simulation as close as I can get it for now. :D

THANKS EVERYONE, I appreciate the time you took with this!

-Jamie
Which recommendation was the one that worked for you?
Just curious. There were three iirc.


I realised you were referring to jsmorley's solution.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.