It is currently April 19th, 2024, 12:29 pm

Measure Explorer Count?

General topics related to Rainmeter.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Measure Explorer Count?

Post by StArL0rd84 »

explorer.png
I need the value in the red circle shown in the image above for one of my skins.
Is it possible to retrieve?

Maybe from the registry?
RegFromApp2.png
Maybe something like this:

Code: Select all

[MeasureExplorer]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SessionInfo\1\ApplicationViewManagement\
RegValue=VirtualDesktop
You do not have the required permissions to view the files attached to this post.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Measure Explorer Count?

Post by jsmorley »

There might be a way using the WMIC tool in Windows, but not sure what that would look like. I don't think the Registry is a good way to go, how do you "count" them?

I just created a quick and dirty addon in AutoIt that can pretty easily do it using RunCommand:

Code: Select all

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

[Variables]
SecondsToCheck=5

[MeasureTimer]
Measure=Calc
Formula=(MeasureTimer % 2 ) + 1
UpdateDivider=(#SecondsToCheck# / 2)
IfCondition=MeasureTimer=1
IfTrueAction=[!CommandMeasure MeasureCountWindows "Run"]

[MeasureCountWindows]
Measure=Plugin
Plugin=RunCommand
OutputType=ANSI
Parameter="#@#Addons\CountExplorerWindows.exe"
FinishAction=[!SetOption MeterCount Hidden "0"]
RegExpSubstitute=1
Substitute="<folders>(.*)</folders>":"\1"

[MeterCount]
Meter=String
MeasureName=MeasureCountWindows
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Hidden=1
Text=%1 Explorer windows open
1.png
CountExplorerWindows_1.0.rmskin
Source is included in the .rmskin.

Code: Select all

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#NoTrayIcon
#include <Array.au3>

Local $aWinList = WinList("[CLASS:CabinetWClass]")
ConsoleWrite("<folders>" & $aWinList[0][0] & "</folders>")
The process name "explorer.exe" doesn't help a bit, Windows has just scads of those running all the time, doing all kinds of things in addition to just "file manager". However the window "class" of "CabinetWClass" is used by and reserved to folders open in Windows Explorer, so counting those will get you there.
You do not have the required permissions to view the files attached to this post.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Measure Explorer Count?

Post by StArL0rd84 »

Wow, thanks J.
Impressive.

But it does not look like it works on my machine.
Im getting:
EWO.png
You do not have the required permissions to view the files attached to this post.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Measure Explorer Count?

Post by jsmorley »

StArL0rd84 wrote:Wow, thanks J.
Impressive.

But it does not look like it works on my machine.
Im getting:
EWO.png
What do you get when you run it in a cmd window?
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Measure Explorer Count?

Post by StArL0rd84 »

Run the .au3 from CMD?
If so, how would i do that?
I dont have a .exe if that's what you meant.
Last edited by StArL0rd84 on November 30th, 2016, 7:57 pm, edited 1 time in total.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Measure Explorer Count?

Post by jsmorley »

StArL0rd84 wrote:Run the .au3 from CMD?
If so, how would i do that?
No, it's a .exe in your @Resources\Addons folder.

What is in the Skins tab in About / Skins for the measure?
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Measure Explorer Count?

Post by StArL0rd84 »

[quote="jsmorley"]No, it's a .exe in your @Resources\Addons folder./quote]
There is no .exe in the @Resources\Addons folder.

EDIT: I redownloaded the skin and converted it into a .rar file.
Found a .exe
I think my anti virus is deleting it. hang on while i check
Last edited by StArL0rd84 on November 30th, 2016, 8:02 pm, edited 1 time in total.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Measure Explorer Count?

Post by jsmorley »

StArL0rd84 wrote:
Sounds like your anti-virus didn't like the .exe and nuked it.
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Measure Explorer Count?

Post by StArL0rd84 »

jsmorley wrote:Sounds like your anti-virus didn't like the .exe and nuked it.
Yup, my anti virus was the culprit.
Excluded the folder, copied .exe.
And the skin works like a charm now.
Thank you for the help man
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Measure Explorer Count?

Post by jsmorley »

Try the .rmskin in the first post again...

I have digitally "signed" the .exe, so it shouldn't be seen as some "unknown" thing by your antivirus.