It is currently April 28th, 2024, 2:50 pm

Trying to make a skin to open specific windows of a program

Get help with creating, editing & fixing problems with skins
Sunyata
Posts: 6
Joined: November 10th, 2023, 8:36 pm

Trying to make a skin to open specific windows of a program

Post by Sunyata »

I'm trying to make a skin that will open specific windows from an application on an Action, as opposed to just running the executable. Usually, simply running the executable will open the default window for that application, but so far I've had issues with Rainmeter and HWinfo. Running the Rainmeter executable just starts it in the background, which is obviously pointless for a skin to do, and I see that there's a Bang (!Manage) to start up the manager window, so that was easy enough to solve. However, I'm trying to accomplish something similar with HWinfo as well.

In the case of HWinfo, the main and sensor windows do open when running the executable, but it generates a UAC prompt every time, and I would prefer to have the skin open *just* the sensor window on action, if it were possible. I figured this would require passing some argument or option to the executable that would be specific to that application, and so I asked about it on the HWinfo forums. The author replied and said he wasn't sure if it's even possible to do something like that from Rainmeter. The only example I can find of a skin passing some kind of argument to an application is one that starts Discord like this:

Code: Select all

LeftMouseUpAction=["C:\Users\UserDirectory\AppData\Local\Discord\Update.exe" --processStart Discord.exe]
I'm not really sure what "processStart" is or does, as it seems like it might be a generic argument that is used by Windows rather than the application itself, but I was hoping someone might know more and be able to point me in the right direction to figuring out if something like this is even possible in theory.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2613
Joined: March 23rd, 2015, 5:26 pm

Re: Trying to make a skin to open specific windows of a program

Post by SilverAzide »

Sunyata wrote: November 10th, 2023, 11:47 pm In the case of HWinfo, the main and sensor windows do open when running the executable, but it generates a UAC prompt every time, and I would prefer to have the skin open *just* the sensor window on action, if it were possible.
Sorry, not possible. The free version of HWiNFO does not support any command-line arguments. The pro version does have them, but they are only for generating reports and such, nothing for opening a certain window. And no matter what, Windows is going to give you a UAC prompt, regardless of which version you are using or what you want it to do. Rainmeter does not factor into this at all.

You can have HWiNFO open the Sensors screen automatically when it runs, if that is what you want. On the Settings screen, UNcheck the option "Minimize Sensors on Startup".
Gadgets Wiki GitHub More Gadgets...
User avatar
Yincognito
Rainmeter Sage
Posts: 7179
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Trying to make a skin to open specific windows of a program

Post by Yincognito »

Just to cover all angles, it would be helpful to know if you want to show the sensor window while the app is running or not, or both. While UAC cannot be avoided unless you globally configure Windows to not use it and you can set HWiNFO to start with only the sensors window as SilverAzide said (you can also edit HWiNFO's own .ini file for that, by the way), Rainmeter is capable of sending window messages to other apps, through the (rarely used by folks, yet still available) WindowMessage plugin:
https://docs.rainmeter.net/manual/plugins/windowmessage/

So, given your discussion with the HWiNFO developer, you can ask him what would be the parameters needed to send such a window message to HWiNFO (e.g. window name or class, message, wparam and lparam) - just out of curiosity and to have an additional possibility available for you. This might probably only work if HWiNFO is already running (not 100% sure about that though), hence my initial question.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Sunyata
Posts: 6
Joined: November 10th, 2023, 8:36 pm

Re: Trying to make a skin to open specific windows of a program

Post by Sunyata »

Yincognito wrote: November 11th, 2023, 10:38 am Rainmeter is capable of sending window messages to other apps, through the (rarely used by folks, yet still available) WindowMessage plugin:
https://docs.rainmeter.net/manual/plugins/windowmessage/

So, given your discussion with the HWiNFO developer, you can ask him what would be the parameters needed to send such a window message to HWiNFO (e.g. window name or class, message, wparam and lparam) - just out of curiosity and to have an additional possibility available for you. This might probably only work if HWiNFO is already running (not 100% sure about that though), hence my initial question.
Perfect, thank you! That is exactly the sort of thing I was looking for. I didn't want to dump a wall of text, but I should have explained that better-my goal is to have a skin that can open the sensor window when HWinfo is *already* running, basically the same thing that you can do by right-clicking on the notification icon. It does so already when launching, but I'm trying to reduce the number of clicks needed to open the window so I can scan over the sensors more casually and keep track of stuff, figure out which sensors I might want to track through skins in the future.
It's hardly a huge problem to have to go through UAC and then close the main window, but given that HWinfo *can* open just the sensor window through a context menu interaction with the notification icon, I thought there may be some way to trigger that same functionality through Rainmeter and wanted to learn more about it.

Thank you both for the fast replies, I really appreciate you taking the time!
User avatar
Yincognito
Rainmeter Sage
Posts: 7179
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Trying to make a skin to open specific windows of a program

Post by Yincognito »

Sunyata wrote: November 11th, 2023, 8:00 pm Perfect, thank you! That is exactly the sort of thing I was looking for. I didn't want to dump a wall of text, but I should have explained that better-my goal is to have a skin that can open the sensor window when HWinfo is *already* running, basically the same thing that you can do by right-clicking on the notification icon. It does so already when launching, but I'm trying to reduce the number of clicks needed to open the window so I can scan over the sensors more casually and keep track of stuff, figure out which sensors I might want to track through skins in the future.
It's hardly a huge problem to have to go through UAC and then close the main window, but given that HWinfo *can* open just the sensor window through a context menu interaction with the notification icon, I thought there may be some way to trigger that same functionality through Rainmeter and wanted to learn more about it.

Thank you both for the fast replies, I really appreciate you taking the time!
No problem, now it's up to the HWiNFO developer to advise you on the parameters you need to pass to the plugin. If that succeeds, feel free to let us know their values, maybe it can help others having similar goals and possibly make the plugin easier to understand and use in general. Not entirely sure about it, but it might be possible to investigate those parameters using a "window spy" tool like the ones in AutoIt (and possibly in AutoHotKey).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Sunyata
Posts: 6
Joined: November 10th, 2023, 8:36 pm

Re: Trying to make a skin to open specific windows of a program

Post by Sunyata »

I don't have the parameters yet, but if I substitute them in once I have them, is this something like how it should look?

Code: Select all

LeftMouseUpAction=!CommandMeasure "MeasureSensorWindow" "?ShowCommand?"
and

Code: Select all

[MeasureSensorWindow]
Measure=Plugin
Plugin=WindowMessagePlugin
WindowClass=?Class or Name of Sensor Window?
Is there somewhere I should be pointing this Window Message to the HWinfo application specifically? I'm inferring that the window will be defined to the OS by the application, and so simply the WindowName or WindowClass will be specific enough for the SendMessage API to find it.
Sunyata
Posts: 6
Joined: November 10th, 2023, 8:36 pm

Re: Trying to make a skin to open specific windows of a program

Post by Sunyata »

Martin (the developer of HWinfo) suggested trying "WM_SHOWWINDOW", so what I have so far is:

Code: Select all

LeftMouseUpAction=!CommandMeasure "MeasureSensorWindow" "WM_SHOWWINDOW"

Code: Select all

[MeasureSensorWindow]
Measure=Plugin
Plugin=WindowMessagePlugin
WindowClass=#32770
From this description of the SHOWWINDOW command, it seems like I might need to send a wParam with it as well, at least. I'm confused though because the Rainmeter manual page for WindowMessage specifies that wParam must be an integer, while the windows manual page for it specifies it as either TRUE or FALSE.

I've tried both "WM_SHOWWINDOW 1" and "WM_SHOWWINDOW TRUE" but with no luck. Some Window Spy tools have listed the Sensor Window's class as "#32770" so I asked Martin for clarification as to whether or not that seems right. Going to keep messing around with it.
User avatar
Yincognito
Rainmeter Sage
Posts: 7179
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Trying to make a skin to open specific windows of a program

Post by Yincognito »

Sunyata wrote: November 11th, 2023, 8:31 pm I don't have the parameters yet, but if I substitute them in once I have them, is this something like how it should look?

Code: Select all

LeftMouseUpAction=!CommandMeasure "MeasureSensorWindow" "?ShowCommand?"
and

Code: Select all

[MeasureSensorWindow]
Measure=Plugin
Plugin=WindowMessagePlugin
WindowClass=?Class or Name of Sensor Window?
Is there somewhere I should be pointing this Window Message to the HWinfo application specifically? I'm inferring that the window will be defined to the OS by the application, and so simply the WindowName or WindowClass will be specific enough for the SendMessage API to find it.
Something like that, yes. Based on what the manual says (hard to find folks who used the plugin so I'm just speculating a bit), this is the best I could do so far:

Code: Select all

; References:
; - https://docs.rainmeter.net/manual/plugins/windowmessage/
; - https://forums.winamp.com/forum/developer-center/winamp-development/156726-winamp-application-programming-interface?s=&threadid=180297

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=47,47,47,255

---Measures---

[MeasureWinamp]
Measure=Plugin
Plugin=WindowMessagePlugin
WindowClass=Winamp v1.x

---Meters---

[Result]
Meter=String
FontColor=255,255,255,255
FontFace=Consolas
FontSize=16
Padding=5,5,5,5
AntiAlias=1
NumOfDecimals=2
Text=Winamp - Begin Play Of Selected Track
LeftMouseUpAction=[!CommandMeasure MeasureWinamp "SendMessage 1024 0 102"]
DynamicVariables=1
It "should" play the selected track in Winamp, but for some reason it plays the track at the top of the list (maybe it's because of the Winamp version or some slightly incorrect parameters). Well, at least it does something, so you could use this as a starting point for the HWiNFO case. Personally, I'd start with something I'm as familiar with as I can be, and only then, having an understanding of how this goes, try things the actual thing I'm interested in - hence the Winamp test, considering there are references to it in the manual.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Sunyata
Posts: 6
Joined: November 10th, 2023, 8:36 pm

Re: Trying to make a skin to open specific windows of a program

Post by Sunyata »

Yincognito wrote: November 11th, 2023, 10:41 pm Personally, I'd start with something I'm as familiar with as I can be, and only then, having an understanding of how this goes, try things the actual thing I'm interested in - hence the Winamp test, considering there are references to it in the manual.
My next step was basically going to be installing Winamp in order to start from there so I appreciate you testing that out, I'm just trying to make sure the Rainmeter portion of what I'm doing is right and then I can toy around with the window class and message some more. It seems like this *should* be possible so I don't think I'll be able to get it out of my head until I figure it out, it will probably take some time though as I don't really have much of a clue what I'm doing.
User avatar
Yincognito
Rainmeter Sage
Posts: 7179
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Trying to make a skin to open specific windows of a program

Post by Yincognito »

Sunyata wrote: November 11th, 2023, 10:19 pm Martin (the developer of HWinfo) suggested trying "WM_SHOWWINDOW", so what I have so far is:

Code: Select all

LeftMouseUpAction=!CommandMeasure "MeasureSensorWindow" "WM_SHOWWINDOW"

Code: Select all

[MeasureSensorWindow]
Measure=Plugin
Plugin=WindowMessagePlugin
WindowClass=#32770
From this description of the SHOWWINDOW command, it seems like I might need to send a wParam with it as well, at least. I'm confused though because the Rainmeter manual page for WindowMessage specifies that wParam must be an integer, while the windows manual page for it specifies it as either TRUE or FALSE.

I've tried both "WM_SHOWWINDOW 1" and "WM_SHOWWINDOW TRUE" but with no luck. Some Window Spy tools have listed the Sensor Window's class as "#32770" so I asked Martin for clarification as to whether or not that seems right. Going to keep messing around with it.
Two things I noticed:
- tried to use the #32770 window class and got a completely different window title in About > Skins from Rainmeter, so I think it's safer in this case to use the WindowName option (aka its title), e.g.

Code: Select all

[MeasureHWiNFO]
Measure=Plugin
Plugin=WindowMessagePlugin
WindowName=HWiNFO64 v7.50-5150 - Sensors Status
- I'm not sure that WM_SHOWWINDOW is the way to go here, since some online sources suggest otherwise, but I think all parameters (message, wparam and lparam) should be decimal numbers, because otherwise Rainmeter will yield an error message about "incorrect number of arguments for the bang" in the Log; so, here is a list of messages and their hexadecimal equivalents (feel free to convert to decimal):
https://www.autohotkey.com/docs/v1/misc/SendMessageList.htm
By the way, I already tried LeftMouseUpAction=[!CommandMeasure MeasureHWiNFO "SendMessage 24 1 0"] and it didn't seem to do anything.

It's an interesting topic for sure, but it's also sure that the documentation for it is severely lacking, and not just in the Rainmeter manual, but generally speaking (might be intentional). Anyway, I'll try some more avenues on this tomorrow, but you can try as well, maybe you'll get to something that's closer to the end result in the meantime.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth