It is currently February 19th, 2020, 11:43 am

plugin to get version info from application

Share and get help with Plugins and Addons
MerijnB
Posts: 1
Joined: November 4th, 2014, 10:02 pm

plugin to get version info from application

Post by MerijnB »

Hi all,

Is anyone aware of a way / plugin to get the version out of an application (GetFileVersionInfo() api call)?

Thanks!
User avatar
jsmorley
Developer
Posts: 20250
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: plugin to get version info from application

Post by jsmorley »

There isn't a plugin for that, but you can use the little sigcheck.exe utility from Microsoft and the RunCommand plugin for Rainmeter to get that info:

sigcheck.exe from Microsoft

Note that you need to run sigcheck.exe one time manually, to agree to the licence terms.

Everything you need is included in the .rmskin. Just install it.
ProgramInfo_1.0.rmskin

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!CommandMeasure GetProgramInfo "Run"]

[GetProgramInfo]
Measure=Plugin
Plugin=RunCommand
Program=""#@#Addons\sigcheck.exe" "C:\Program Files\Rainmeter\Rainmeter.exe""
State=Hide
OutputType=ANSI
FinishAction=[!ShowMeter MeterProductVersion]

[GetProgramName]
Measure=String
String=[GetProgramInfo]
DynamicVariables=1
RegExpSubstitute=1
Substitute="(?siU)^.*Product:\t(.*)\n.*$":"\1","#CRLF#":""

[GetProgramVersion]
Measure=String
String=[GetProgramInfo]
DynamicVariables=1
RegExpSubstitute=1
Substitute="(?siU)^.*Prod version:\t(.*)\n.*$":"\1","#CRLF#":""

[MeterProductVersion]
Meter=String
FontSize=13
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Program Name: [GetProgramName]#CRLF#Version: [GetProgramVersion]
Hidden=1
DynamicVariables=1
sigcheck.exe output will be:

Code: Select all


Sigcheck v2.1 - File version and signature viewer
Copyright (C) 2004-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

c:\program files\rainmeter\Rainmeter.exe:
	Verified:	Signed
	Signing date:	12:04 PM 11/21/2014
	Publisher:	Open Source Developer
	Description:	n/a
	Product:	Rainmeter
	Prod version:	3.2.0.2343 (64-bit)
	File version:	3.2.0.2343
	MachineType:	64-bit
2014-11-26_145031.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
rbriddickk84
Rainmeter Sage
Posts: 208
Joined: February 17th, 2014, 12:39 pm
Location: Hungary

Re: plugin to get version info from application

Post by rbriddickk84 »

Hi!

Is there a way to Substitute the version, to get only the numbers, like:
"3202343"

instead of

"3.2.0.2343 (64-bit)"

I am working on a small version checker and notify skin, and i can only check numbers only in calc measure.
User avatar
jsmorley
Developer
Posts: 20250
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: plugin to get version info from application

Post by jsmorley »

rbriddickk84 wrote:Hi!

Is there a way to Substitute the version, to get only the numbers, like:
"3202343"

instead of

"3.2.0.2343 (64-bit)"

I am working on a small version checker and notify skin, and i can only check numbers only in calc measure.

Code: Select all

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

[MeasureString]
Measure=String
String=3.2.0.2343 (64-bit)
RegExpSubstitute=1
Substitute="^(\d).(\d).(\d).(\d\d\d\d).*$":"\1\2\3\4"

[MeasureCalc]
Measure=Calc
Formula=[MeasureString]
DynamicVariables=1

[MeterString]
Meter=String
MeasureName=MeasureCalc
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
The thing to be careful of when using Substituted values in Calc measures or other formulas, is that you always use the "string value" of the source measure, and not the "number value". That is why this is Formula=[MeasureString] and NOT Formula=MeasureString. The number value of a measure, if it even has a valid one, is never "substituted", only string values are.
User avatar
rbriddickk84
Rainmeter Sage
Posts: 208
Joined: February 17th, 2014, 12:39 pm
Location: Hungary

Re: plugin to get version info from application

Post by rbriddickk84 »

Wow, thank you very much!

Uhm, can i ask one more thing, about that Substitution. I tried to figure it out, how those parts works, it seems a totally different substitution form. Is there any documentation about that i missed?
User avatar
jsmorley
Developer
Posts: 20250
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: plugin to get version info from application

Post by jsmorley »

rbriddickk84 wrote:Wow, thank you very much!

Uhm, can i ask one more thing, about that Substitution. I tried to figure it out, how those parts works, it seems a totally different substitution form. Is there any documentation about that i missed?
https://docs.rainmeter.net/manual-beta/measures/general-options/substitute/#RegExpSubstitute

https://docs.rainmeter.net/manual-beta/skins/option-types/#RegExp

P.S. That one I used is pretty "future resistant" as we are not likely to have more digits in any of the version, sub version, minor version or build values anytime in the next few years, but to be "future proof" you might use:

Substitute="^([\d]{1,4}).([\d]{1,4}).([\d]{1,4}).([\d]{4,8}).*$":"\1\2\3\4"

Doubt we are ever going to get to version 10000 of Rainmeter... Unless my great, great grandchildren create one for the computer they have implanted in their retinas. Hard to say what version numbers will look like in the Galactic Common Language anyway...
User avatar
rbriddickk84
Rainmeter Sage
Posts: 208
Joined: February 17th, 2014, 12:39 pm
Location: Hungary

Re: plugin to get version info from application

Post by rbriddickk84 »

jsmorley wrote:Doubt we are ever going to get to version 10000 of Rainmeter... Unless my grandchildren create one for the computer they have implanted in their retinas.
:rolmfao:
You never know ;)

Million thanks for your helps Sir! :)
User avatar
jsmorley
Developer
Posts: 20250
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: plugin to get version info from application

Post by jsmorley »

rbriddickk84 wrote::rolmfao:
You never know ;)

Million thanks for your helps Sir! :)
I am a leaf on the wind...
User avatar
rbriddickk84
Rainmeter Sage
Posts: 208
Joined: February 17th, 2014, 12:39 pm
Location: Hungary

Re: plugin to get version info from application

Post by rbriddickk84 »

Oh my God, this RegExp and it's Substitution are a nightmare O.O
Probably i will learn Chinese sooner than that :rofl:

I made a possibly working version update notifier skin, is that worth sharing, or someone else already made one here?
User avatar
jsmorley
Developer
Posts: 20250
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: plugin to get version info from application

Post by jsmorley »

It's simple!!! :-)

String:
3.2.0.2343 (64-bit)

Regular Expression:
^([\d]{1,4}).([\d]{1,4}).([\d]{1,4}).([\d]{4,8}).*$

What the expression does:

Code: Select all

^ asserts position at start of the string
1st Capturing Group ([\d]{1,4})
Match a single character present in the list below [\d]{1,4}
{1,4} Quantifier — Matches between 1 and 4 times, as many times as possible, giving back as needed (greedy)
\d matches a digit (equal to [0-9])
. matches any character (except for line terminators)
2nd Capturing Group ([\d]{1,4})
Match a single character present in the list below [\d]{1,4}
{1,4} Quantifier — Matches between 1 and 4 times, as many times as possible, giving back as needed (greedy)
\d matches a digit (equal to [0-9])
. matches any character (except for line terminators)
3rd Capturing Group ([\d]{1,4})
Match a single character present in the list below [\d]{1,4}
{1,4} Quantifier — Matches between 1 and 4 times, as many times as possible, giving back as needed (greedy)
\d matches a digit (equal to [0-9])
. matches any character (except for line terminators)
4th Capturing Group ([\d]{4,8})
Match a single character present in the list below [\d]{4,8}
.* matches any character (except for line terminators)
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
$ asserts position at the end of the string, or before the line terminator right at the end of the string (if any)
Result:

Code: Select all

Full match	0-19	`3.2.0.2343 (64-bit)`
Group 1.	0-1	`3`
Group 2.	2-3	`2`
Group 3.	4-5	`0`
Group 4.	6-10	`2343`

https://regex101.com/

Ok, maybe not "simple"...