It is currently December 1st, 2020, 5:53 pm

Question regarding a WMI plugin

Share and get help with Plugins and Addons
User avatar
Yincognito
Posts: 2933
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Question regarding a WMI plugin

Post by Yincognito »

I didn't find info on this anywhere, so I'll ask it here, maybe someone (the author or the developers) knows : is this plugin "workable"? I mean, did someone test it or compiled it to see if it does its job?

Not only I didn't find any info on the above, but it seems there are no compiled .dlls of that. Maybe someone has them, by any chance?

P.S. If it works, it may be useful to me as I want to get the CPU architecture (x86 or x64) in my skins and the registry seems to provide keys for that only in OS's case (which can be grabbed by SysInfo anyway).
User avatar
jsmorley
Developer
Posts: 21563
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question regarding a WMI plugin

Post by jsmorley »

I am not at all familiar with that WMI plugin, but it hasn't been updated for a couple of years, and I personally would be hesitant about it.

I would point out that in general, you should only use WMI information if you have no alternative. The reason that I say that is because WMI is both slow and CPU intensive, and one of the least "efficient" ways to get stuff.

However, sometimes there may not be a good alternative, and as long as you don't use it for something that you need "real-time", asking for it every second or something that will just perform hideously, then you can get pretty much anything you want from it from the WMIC command line.

Use the RunCommand plugin from Brian. Get that first.

Then you can use a skin like:

Code: Select all

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

[MeasureCPUBits]
Measure=Plugin
Plugin=RunCommand
Parameter=wmic cpu where DeviceID='CPU0' get AddressWidth 
OutputType=ANSI
IfCondition=1
IfTrueAction=[!CommandMeasure MeasureCPUBits "Run"]
FinishAction=[!ShowMeter MeterCPUBits]
IfMatch=64
IfMatchAction=[!SetOption MeterCPUBits Text "CPU Architecture is 64-bit]
IfNotMatchAction=[!SetOption MeterCPUBits Text "CPU Architecture is 32-bit]

[MeterCPUBits]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Hidden=1
1.png
P.S. Not sure what point CPU Architecture has, since the only thing that ever really matters is OS Architecture, but mine is not to reason why...
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Posts: 2933
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Question regarding a WMI plugin

Post by Yincognito »

Well, I think the WMI itself (or better said at least its syntax) has not changed that much over the years, so I tend to think the plugin's age wouldn't be a critical problem. But you're right, your way (using RunCommand plugin) seems to be the right one.

Of course I wouldn't use WMI once every second - after all, you need to reboot to change the CPU (thus being able to "change its architecture"), which makes this specific query perfect for an UpdateDivider of -1.

Thank you very much for your kind info on the subject. The point of displaying both the OS and the CPU architecture would be:

- the annoying difficulty of getting this info in Windows itself (apart from the classical and confusing System Information search for "x64-based PC" string - which for an inexperienced user could mean anything, including that the OS is 64-bit)
- for the beginners (who most of the times don't even know the type of hardware they have in their system) would be a plus, since they could be encouraged to install an x64 OS on an x64 CPU, if they would plainly see that they didn't took full advantage of the hardware (e.g. they mistakenly installed only a 32-bit OS instead of a 64-bit one, while their CPU is x64).

And...I have a little space left in the corner of the CPU skin available :D
Wouldn't be nice to replicate the Multimeter gadget for Windows 7 on that little space, eh?
User avatar
jsmorley
Developer
Posts: 21563
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question regarding a WMI plugin

Post by jsmorley »

Yincognito wrote: Thank you very much for your kind info on the subject. The point of displaying both the OS and the CPU architecture would be:

- the annoying difficulty of getting this info in Windows itself (apart from the classical and confusing System Information search for "x64-based PC" string - which for an inexperienced user could mean anything, including that the OS is 64-bit)
- for the beginners (who most of the times don't even know the type of hardware they have in their system) would be a plus, since they could be encouraged to install an x64 OS on an x64 CPU, if they would plainly see that they didn't took full advantage of the hardware (e.g. they mistakenly installed only a 32-bit OS instead of a 64-bit one, while their CPU is x64).

And...I have a little space left in the corner of the CPU skin available :D
Wouldn't be nice to replicate the Multimeter gadget for Windows 7 on that little space, eh?
So in short, "because I can..." ;-)
User avatar
jsmorley
Developer
Posts: 21563
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question regarding a WMI plugin

Post by jsmorley »

Yincognito wrote:Well, I think the WMI itself (or better said at least its syntax) has not changed that much over the years, so I tend to think the plugin's age wouldn't be a critical problem. But you're right, your way (using RunCommand plugin) seems to be the right one.

Of course I wouldn't use WMI once every second - after all, you need to reboot to change the CPU (thus being able to "change its architecture"), which makes this specific query perfect for an UpdateDivider of -1.
It's not that I think WMI has changed in a couple of years, but more that that plugin was never publicly available that I know of, and when someone creates a Rainmeter plugin, never really makes a big deal about it, and then just drops any further work on it years ago, that makes me suspicious about it.

Might work just fine, I don't know. I'm not interested in trying to build it and test it out. I have found that WMIC and RunCommand is all you ever need to get WMI information.

As to RunCommand, you don't need to use UpdateDivider=-1 on it, as a RunCommand plugin measure is in a sense never updated. The plugin is only executed when you send a !CommandMeasure action to it, with the parameter "Run".
User avatar
Yincognito
Posts: 2933
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Question regarding a WMI plugin

Post by Yincognito »

So in short, "because I can..." ;-)
Ha ha, well, yes - more or less 8-)
You've just ruined my aura of responsibility towards the helpless inexperienced users though... :uhuh:
And so goes my chance to save the world...again :(
User avatar
Yincognito
Posts: 2933
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Question regarding a WMI plugin

Post by Yincognito »

I have found that WMIC and RunCommand is all you ever need to get WMI information.
I agree. I used the same approach (grabbing relevant strings from hidden cmd window that ran ffmpeg) in helping to design a Sony Vegas plugin for scene detection.
As to RunCommand, you don't need to use UpdateDivider=-1 on it, as a RunCommand plugin measure is in a sense never updated.
It ... makes sense to - in a sense - never update a RunCommand plugin measure ;-) Thanks again, as always, for the insight into this.
User avatar
jsmorley
Developer
Posts: 21563
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question regarding a WMI plugin

Post by jsmorley »

Yincognito wrote:
To be clear, the "measure" is in fact updated just like any other measure. However, the plugin itself will not do any work unless commanded to with "Run".

You can set UpdateDivider=-1 on it if you like, but I see no real need.
User avatar
Yincognito
Posts: 2933
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Question regarding a WMI plugin

Post by Yincognito »

To be clear, the "measure" is in fact updated just like any other measure. However, the plugin itself will not do any work unless commanded to with "Run".
I see.

But...I just tested the wmic cpu where DeviceID='CPU0' get AddressWidth command in a VirtualBox Windows XP SP3 on 32 bits and, although my CPU is x64, it returns

Code: Select all

Address Width
32
I don't want to bother you further with this - you were kind enough to answer me in the first place - probably some other wmi query would do the trick though... At least I now know the "method".
User avatar
jsmorley
Developer
Posts: 21563
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question regarding a WMI plugin

Post by jsmorley »

Yeah, I don't use VirtualBox, but I suspect it is emulating a 32bit hardware environment.