It is currently March 28th, 2024, 3:56 pm

Get name of your display adapter / graphics card

Share and get help with Plugins and Addons
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Get name of your display adapter / graphics card

Post by jsmorley »

It is extremely complicated bordering on impossible to get the name of your graphics card / display adapter from the Windows registry. This information is actually retrieved by Windows and applications using a Windows API call that queries the display driver, rather than just being stored as plain text. So I thought I would knock out a little addon to retrieve that information for use in a skin if you need it.

Get and install this skin. The addon will also be installed in the Rainmeter\Addons folder.
GetAdapter.rmskin
(363.56 KiB) Downloaded 1020 times
The skin is just a little example to show how to use the addon.

Here is the skin code so I can explain a couple of things:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
OnRefreshAction=!Execute ["#ADDONSPATH#DisplayAdapter\DisplayAdapter.exe" "#CURRENTPATH#DisplayAdapter.txt"][!RainmeterEnableMeasure MeasureGetAdapter "#CURRENTCONFIG#"]

[MeasureGetAdapter]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=file://#CURRENTPATH#DisplayAdapter.txt
RegExp="(?siU)<DisplayAdapter>(.*)</DisplayAdapter>"
StringIndex=1
FinishAction=!Execute [!RainmeterDisableMeasure MeasureGetAdapter "#CURRENTCONFIG#"]
Disabled=1

[MeterDisplay]
Meter=String
MeasureName=MeasureGetAdapter
FontSize=10
FontColor=255,255,255,255
StringStyle=Bold
So what happens is that when the skin is loaded or refreshed, the addon is run and creates a little text file with the information in the designated location and file. It then "enables" a WebParser measure to read the file and display it with a string meter.

The reason I do it this way, with the WebParser measure disabled, is for two reasons. First, there is no need to EVER execute this addon on any "timed" basis. You obviously can't change your video card while Rainmeter is running. No matter how big you make UpdateRate on the measure, it's technically always a waste of resources. Second, due to the nature of Rainmeter, when you first run the skin brand new there will not yet be the text file created by the addon, so nothing will be returned on the first pass. Using the OnRefreshAction with the "!RainmeterEnableMeasure" gives the addon time to create the file before the WebParser measure is run.
Last edited by jsmorley on July 16th, 2011, 8:50 pm, edited 1 time in total.
Reason: Edited and attachment updated to add quotes to #CURRENTCONFIG#
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Get name of your display adapter / graphics card

Post by jsmorley »

Modified to work better with UAC and not cause security prompts.
Weidbrewer
Posts: 11
Joined: June 9th, 2011, 3:39 pm

Re: Get name of your display adapter / graphics card

Post by Weidbrewer »

Hmm...I'm a total n00b here, but I wanted to try this tool out, and ran into some issues right off the bat.

I downloaded it, and it ran an installer. I ran the installer and hit "refresh all" on the task bar, and a skin I was working on got modified. Specifically, I had an image file that I was using as a foreground on my project, and now it now longer displays.

Any ideas?

(Also, there was a "Rainbackup" and a "Rain Browser" in my programs list that I hadn't seen before and couldn't uninstall - were this installed with this project, or are they default features that I didn't know about?)
Weidbrewer
Posts: 11
Joined: June 9th, 2011, 3:39 pm

Re: Get name of your display adapter / graphics card

Post by Weidbrewer »

Never mind. I'm an idiot. Some how, upon a refresh, it had just switched to an older version of my skin I didn't realize I still had installed.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Get name of your display adapter / graphics card

Post by jsmorley »

(Also, there was a "Rainbackup" and a "Rain Browser" in my programs list that I hadn't seen before and couldn't uninstall - were this installed with this project, or are they default features that I didn't know about?)

Those are addons that come with Rainmeter when you install it. http://rainmeter.net/cms/Rainmeter101
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK
Contact:

Re: Get name of your display adapter / graphics card

Post by Seahorse »

This works perfectly in another skin and it's functional on my desktop.

A straight cut & paste from the old skin to the new one, refresh skin, sees Display adapter.txt appear in the correct folder with the right details.

However, Rainmeter "About" shows nothing on the new skin for MeasureGetAdaptor, but the right info on the old skin.

Is this plugin something that can only be run once from one skin in one Windows session? Failing that I'll reboot writes a test skin using the above example and see it plays nice... :lol:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Get name of your display adapter / graphics card

Post by jsmorley »

Seahorse wrote:This works perfectly in another skin and it's functional on my desktop.

A straight cut & paste from the old skin to the new one, refresh skin, sees Display adapter.txt appear in the correct folder with the right details.

However, Rainmeter "About" shows nothing on the new skin for MeasureGetAdaptor, but the right info on the old skin.

Is this plugin something that can only be run once from one skin in one Windows session? Failing that I'll reboot writes a test skin using the above example and see it plays nice... :lol:
You know you have a typo somewhere... :-)

You certainly can have more than one skin using it at a time. That is not an issue.
7-16-2011 2-46-36 PM.jpg
User avatar
Seahorse
Posts: 1175
Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK
Contact:

Re: Get name of your display adapter / graphics card

Post by Seahorse »

I assumed typo so cut & pasted from source into the skin with the same result, so I moved onto a test skin using teh code from the OP and still get nothing.
Capture1.PNG
However the skin it was originally used in, Skeleton, works fine.
Capture2.PNG
What I find really confusing is it is clearly working as far as the create DisplayAdapter.txt part:
Capture3.PNG
which makes it look like the RegExp is failing, but given that identical code works here and for two instances at your end that doesn't make sense either.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Get name of your display adapter / graphics card

Post by jsmorley »

I think you are going to find you are missing some quotes somewhere, since your new config has a space in the name.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Get name of your display adapter / graphics card

Post by jsmorley »

Probably in the URL setting on the WebParser measure.
Post Reply