It is currently April 26th, 2024, 10:57 am

Get Rainmeter to show its own version number

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Get Rainmeter to show its own version number

Post by Yincognito »

If it wasn't for mak_kawa's excellent PowerShell command, one could have even try to parse the EXE locally with WebParser and get the version:
Rainmeter Version.jpg
It is very close to the file header part, so it's probably not going to be overkill. A brute approach, yes, but it should work just like other more elegant methods.
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Get Rainmeter to show its own version number

Post by mak_kawa »

Hi Yincognito

Parsing exe binary file by WebParser is a surprising idea... :o
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Get Rainmeter to show its own version number

Post by Yincognito »

mak_kawa wrote: August 21st, 2020, 11:26 am Hi Yincognito

Parsing exe binary file by WebParser is a surprising idea... :o
Yeah, that's the first thing that popped into my head when reading the original question - up until seeing your reply, that is. I was already preparing to counter jsmorley's "Nope, can't be done in Rainmeter" assessment...again. :lol: Then he would have said that it can easily be done in Lua and there you go: same old "battle" between the forces of light and the forces of darkness... :twisted:

But then you spoiled the fun with your stylish PowerShell trick, so I said to myself "no battle today, I must save my forces for another day". :D
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
jn_meter
Posts: 136
Joined: December 27th, 2016, 12:04 pm

Re: Get Rainmeter to show its own version number

Post by jn_meter »

Dear all (especially the battle-ready Yincognito),

Thank you very much. I have used the Powershell technique.

@jsmorley: you're a Rainmeter developer, right? Presuming yes: don't you think Rainmeter should be able, easily, to show its version number? (Or is it shy?) How about implementing that?
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Get Rainmeter to show its own version number

Post by mak_kawa »

Hi jn_meter

I personally don't feel necessity that Rainmeter provides its version number as, for example, system built-in variable like #VERSIONNUMBER#, because the powershell and RunCommand method works flawlessly so far. I rather prefer such way. :-)

But if it was implemented, getting version number would be more simple, not bad.
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Get Rainmeter to show its own version number

Post by Yincognito »

jn_meter wrote: August 21st, 2020, 10:27 pm Dear all (especially the battle-ready Yincognito),

Thank you very much. I have used the Powershell technique.

@jsmorley: you're a Rainmeter developer, right? Presuming yes: don't you think Rainmeter should be able, easily, to show its version number? (Or is it shy?) How about implementing that?
Yeah, I was in a good mood for some joking at the time of posting - no harm done, I suppose. 8-) If the devs decide getting Rainmeter's version should be implemented, it could be suitable for a built-in variable or something. In the meantime, here's another (possibly quicker than PowerShell) way of getting Rainmeter's version, using the same approach through RunCommand:

Code: Select all

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

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=wmic datafile where name="C:\\Program Files\\Rainmeter\\Rainmeter.exe" get Version /value
State=Hide
OutputType=ANSI
Timeout=5000
RegExpSubstitute=1
Substitute="^(?:^\s+|\s+$)$":"","#CRLF#":"","Version=":""

[MeterRun]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Click to Run
LeftMouseUpAction=[!CommandMeasure MeasureRun "Run"]

[MeterResult]
Meter=String
MeasureName=MeasureRun
Y=10R
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
Text="Rainmeter's version: %1"
Result:
Rainmeter Version.jpg
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
jn_meter
Posts: 136
Joined: December 27th, 2016, 12:04 pm

Re: Get Rainmeter to show its own version number

Post by jn_meter »

Thanks, Yincognito, that does indeed seem slightly faster than the Powershell version.
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Get Rainmeter to show its own version number

Post by Yincognito »

jn_meter wrote: August 22nd, 2020, 9:16 am Thanks, Yincognito, that does indeed seem slightly faster than the Powershell version.
Yeah, if it wasn't for these commands having to parse the file in the background to get the version (i.e. doing more or less what my brute approach does, in the background), it would be even faster. That's the thing that bothers me a bit about PowerShell: while it has way more capabilities than cmd.exe and such, that comes at a price, since it's slower than its so called "outdated" / "obsolete" (but still effective despite being "out of fashion" nowadays, notice the irony) counterparts.

EDIT: I think I'll try to implement the brute approach above as well, so we can all make a comparison and see which variant is quicker. Stay tuned.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7170
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Get Rainmeter to show its own version number

Post by Yincognito »

Yep, tried the WebParser method, but unfortunately without much success, probably due to the code page or some other stuff that prevents the parser to get the whole EXE file contents. For example, the commented line below should do the job, but it can't because only the MZ file signature of the EXE is parsed by WebParser, as it can be seen by running the uncommented line above it:

Code: Select all

[Variables]

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

---Measures---

[MeasureFile]
Measure=WebParser
Url="file://C:\Program Files\Rainmeter\Rainmeter.exe"
CodePage=65001
RegExp=(?siU)^(.*)$
;RegExp=F.i.l.e.V.e.r.s.i.o.n.{5}(.*)\W{5}
UpdateRate=600
FinishAction=[!UpdateMeasureGroup "FileGroup"][!UpdateMeter *][!Redraw]

[MeasureVersion]
Measure=WebParser
Url=[MeasureFile]
StringIndex=1
RegExpSubstitute=1
Substitute="\.+":"."

---Meters---

[MeterFile]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Click to Parse File
LeftMouseUpAction=[!CommandMeasure MeasureFile "Update"]

[MeterResult]
Meter=String
MeasureName=MeasureVersion
Y=10R
FontSize=14
FontColor=255,255,255,255
AntiAlias=1
Text="Rainmeter's version: %1"
I set the CodePage to 65001 (i.e. Unicode UTF-8) instead of the classic 1200 (i.e. Unicode UTF-16 LE) since the latter was worse, in effect getting nothing at all from the file, not even the MZ file signature. Maybe the devs could shed some light into why this happens... :confused:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth