It is currently March 28th, 2024, 2:41 pm

Any way to have a button that rotates a specific screen/monitor when clicked?

Get help with creating, editing & fixing problems with skins
imkrut
Posts: 6
Joined: January 5th, 2021, 4:50 pm

Any way to have a button that rotates a specific screen/monitor when clicked?

Post by imkrut »

Any way to have a button that rotates a specific screen/monitor when clicked (90º) so I can have a vertical or horizontal aspect ratio ratio on demand with a visual cue?

If it doesn't exist but it's possible, would appreciate a point in the right direction.

Thank you!
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Any way to have a button that rotates a specific screen/monitor when clicked?

Post by balala »

imkrut wrote: January 5th, 2021, 5:11 pm Any way to have a button that rotates a specific screen/monitor when clicked (90º) so I can have a vertical or horizontal aspect ratio ratio on demand with a visual cue?

If it doesn't exist but it's possible, would appreciate a point in the right direction.
A possible solution might be here (see the first reply, but to be honest I didn't try it out). You have to download and use a .exe. To download use one of the posted mirrors, the direct link seems to not working.
Does the tool work? If it does and you need assistence on how to use it into a Rainmeter code, please let me (us) know.
imkrut
Posts: 6
Joined: January 5th, 2021, 4:50 pm

Re: Any way to have a button that rotates a specific screen/monitor when clicked?

Post by imkrut »

balala wrote: January 5th, 2021, 6:22 pm A possible solution might be here (see the first reply, but to be honest I didn't try it out). You have to download and use a .exe. To download use one of the posted mirrors, the direct link seems to not working.
Does the tool work? If it does and you need assistence on how to use it into a Rainmeter code, please let me (us) know.
It does work! yes, assistance into wrapping this into a skin/plugin for Rainmeter would be great, so it can be uploaded and shared/used by someone else too.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Any way to have a button that rotates a specific screen/monitor when clicked?

Post by balala »

imkrut wrote: January 6th, 2021, 1:24 pm It does work!
Alright, I'm glad.
imkrut wrote: January 6th, 2021, 1:24 pm yes, assistance into wrapping this into a skin/plugin for Rainmeter would be great, so it can be uploaded and shared/used by someone else too.
Do you have a starting skin, to work with? If you do have one, post its code please, however I suppose thereis no code so far. If I'm right and you indeed don't have one, I'm gonna write a short sample code, just please let me know.
imkrut
Posts: 6
Joined: January 5th, 2021, 4:50 pm

Re: Any way to have a button that rotates a specific screen/monitor when clicked?

Post by imkrut »

balala wrote: January 6th, 2021, 4:38 pm
Do you have a starting skin, to work with? If you do have one, post its code please, however I suppose thereis no code so far. If I'm right and you indeed don't have one, I'm gonna write a short sample code, just please let me know.
Nothing really relevant, I followed the tutorial here:
https://docs.rainmeter.net/tips/button-images/

And this particular code:

Code: Select all

[MeterSample]
Meter=Button
X=1
Y=1
ButtonImage=MyButton.png
ButtonCommand=["SomeCommand"]
The button part worked just fine, however I tried linking the path of the shortcut ("X:\Display\display64.exe /device 2 /rotate:90 /toggle") to the "button command" line

( ButtonCommand=["SomeCommand"] )
like so
( ButtonCommand=["X:\Display\display64.exe /device 2 /rotate:90 /toggle"] )

But that did not work.
Last edited by balala on January 7th, 2021, 4:51 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are posting code snippets. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Any way to have a button that rotates a specific screen/monitor when clicked?

Post by balala »

imkrut wrote: January 6th, 2021, 10:58 pm But that did not work.
Ok, add the following measure to your code:

Code: Select all

[MeasureRotate]
Measure=Plugin
Plugin=RunCommand
Program=X:\Display\display64.exe
Parameter=/device 2 /rotate:90 /toggle
State=Hide
This is a RunCommand plugin measure, which when executed, runs the Program, with the posted Parameter. To run it, replace the ButtonCommand option with the following one: ButtonCommand=[!CommandMeasure "MeasureRotate" "Run"].
Does it work now?
imkrut
Posts: 6
Joined: January 5th, 2021, 4:50 pm

Re: Any way to have a button that rotates a specific screen/monitor when clicked?

Post by imkrut »

balala wrote: January 7th, 2021, 4:57 pm Ok, add the following measure to your code:

Code: Select all

[MeasureRotate]
Measure=Plugin
Plugin=RunCommand
Program=X:\Display\display64.exe
Parameter=/device 2 /rotate:90 /toggle
State=Hide
This is a RunCommand plugin measure, which when executed, runs the Program, with the posted Parameter. To run it, replace the ButtonCommand option with the following one: ButtonCommand=[!CommandMeasure "MeasureRotate" "Run"].
Does it work now?

Perfectly.

3 follow up questions:

1) Is the used program now "integrated" into the skin? if not, can it be done for easier sharing/reinstalling?
2) Is there a way to disable the multiple images necessary for a single icon (only have one image, and not a static, on hover and pressed image) ? (or just use an icon/ico file?
3) Can I make the icon resizable via click and drag? or can I input a specific size for the icon on the ini file?

Thank you.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Any way to have a button that rotates a specific screen/monitor when clicked?

Post by balala »

imkrut wrote: January 7th, 2021, 6:22 pm Perfectly.
Great. I'm glad.
imkrut wrote: January 7th, 2021, 6:22 pm 1) Is the used program now "integrated" into the skin? if not, can it be done for easier sharing/reinstalling?
No, at all, the program is not integrated yet, but yes, it can easilly be integrated. To do this, I'd move the display64.exe app into the @Resources folder (which is the best place for such programs and additionally if you create a skin installer, it is included into that), let say into an Addons (or whatever) subfolder of @Resources, and would use it from there.
If interested, identify the @Resources folder. It is in the root config (the first folder into the Skins folder, which less or more deeper contains your skin's .ini file). Create an Addons folder in this @Resources folder and move the display64.exe file there. If you do this, you can access your display64.exe as #@#Addons\display64.exe within your skin.
Replace the Program option of the [MeasureRotate] measure with Program=#@#Addons\display64.exe.
Now if pack (or create a skin installer) the config, it integrates the program as well.
imkrut wrote: January 7th, 2021, 6:22 pm 2) Is there a way to disable the multiple images necessary for a single icon (only have one image, and not a static, on hover and pressed image) ? (or just use an icon/ico file?
Sorry, not sure I understand. Are you talking about the images of the MyButton.png image (its "frames")? But what do you mean by "disable"?
imkrut wrote: January 7th, 2021, 6:22 pm 3) Can I make the icon resizable via click and drag?
No, you can't in Rainmeter, at least not simply, just maybe through an artifact I don't recommend.
imkrut wrote: January 7th, 2021, 6:22 pm or can I input a specific size for the icon on the ini file?
Yes, you can do this, but would be much easier to replace the Button meter with an Image meter, in which case you can set easilly its size with W and H options. The Button meter doesn't support these options, as you can see in the General meter options section of the Button meter. Are you interested and if you are, do you know how to do this? Please let me know if you need assistence.
imkrut
Posts: 6
Joined: January 5th, 2021, 4:50 pm

Re: Any way to have a button that rotates a specific screen/monitor when clicked?

Post by imkrut »

balala wrote: January 7th, 2021, 6:55 pm No, at all, the program is not integrated yet, but yes, it can easilly be integrated. To do this, I'd move the display64.exe app into the @Resources folder (which is the best place for such programs and additionally if you create a skin installer, it is included into that), let say into an Addons (or whatever) subfolder of @Resources, and would use it from there.
If interested, identify the @Resources folder. It is in the root config (the first folder into the Skins folder, which less or more deeper contains your skin's .ini file). Create an Addons folder in this @Resources folder and move the display64.exe file there. If you do this, you can access your display64.exe as #@#Addons\display64.exe within your skin.
Replace the Program option of the [MeasureRotate] measure with Program=#@#Addons\display64.exe.
Now if pack (or create a skin installer) the config, it integrates the program as well.
Awesome, this is basically what I was missing, the rest can be managed as is.
balala wrote: January 7th, 2021, 6:55 pm
Sorry, not sure I understand. Are you talking about the images of the MyButton.png image (its "frames")? But what do you mean by "disable"?
Yes, that's what I mean.
Specifically I mean, in cases where I don't need a "mouse over" or "pressed", If it's possible to just use the first frame only.

Alternatively, is it possible to have more frames for each state ? (say a looping animation for the "Static" image) or an animation for the "pressed".

balala wrote: January 7th, 2021, 6:55 pmYes, you can do this, but would be much easier to replace the Button meter with an Image meter, in which case you can set easilly its size with W and H options. The Button meter doesn't support these options, as you can see in the General meter options section of the Button meter. Are you interested and if you are, do you know how to do this? Please let me know if you need assistence.
I'll further look into the link you provided before bothering you with more specific questions if needed.
Thank you so much for your help, basically got my setup just like I wanted/needed.


Not sure if it's "ok" to share the stuff you helped me make (both auxiliary apps/addons I'm using don't seem to have anything against it in their license) but if so, what's the best way to share them?

Thank you again. :welcome:
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Any way to have a button that rotates a specific screen/monitor when clicked?

Post by CodeCode »

imkrut wrote: January 7th, 2021, 9:54 pm so, what's the best way to share them?
DeviantArt is a good place. It is free to use, and lots of people share their work there. (Maybe credit the contributor/s in the description).
Post Reply