It is currently April 27th, 2024, 5:11 pm

Using UsageMonitor stste to toggle output to a string.

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Using UsageMonitor stste to toggle output to a string.

Post by CodeCode »

Hello,
I am working on a skin that is entirely for the purpose of determining if vlc is the active window.

This is after several tries:

Code: Select all

[MeasureOnlyVlc]
Measure=PlugIn
PlugIn=Process
Whitelist=vlc
IfCondition=MeasureOnlyVlc = 1
IfTrueAction=[!SetOption CentreText Text ""[MeasureActiveTitle]""][!SetOption CentreTextVisible Text ""[MeasureActiveTitle]""][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption CentreText Text "VLC INACTIVE"][!SetOption CentreTextVisible Text "VLC INACTIVE"]
IfConditionMode=1
DynamicVariables=1

[MeasureActiveTitle]
Measure=Plugin
Plugin=GetActiveTitle
DynamicVariables=1
It returns the same string of vlc inactive for several tries, trying to get it valued either 1 or -1. Obviously -1 is not running and 1 is.

Its... something obvious - but I haven't been able to get it right.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Using UsageMonitor stste to toggle output to a string.

Post by eclectic-tech »

CodeCode wrote: December 9th, 2023, 12:34 am Hello,
I am working on a skin that is entirely for the purpose of determining if vlc is the active window.

This is after several tries:

Code: Select all

[MeasureOnlyVlc]
Measure=PlugIn
PlugIn=Process
Whitelist=vlc
IfCondition=MeasureOnlyVlc = 1
IfTrueAction=[!SetOption CentreText Text ""[MeasureActiveTitle]""][!SetOption CentreTextVisible Text ""[MeasureActiveTitle]""][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption CentreText Text "VLC INACTIVE"][!SetOption CentreTextVisible Text "VLC INACTIVE"]
IfConditionMode=1
DynamicVariables=1

[MeasureActiveTitle]
Measure=Plugin
Plugin=GetActiveTitle
DynamicVariables=1
It returns the same string of vlc inactive for several tries, trying to get it valued either 1 or -1. Obviously -1 is not running and 1 is.

Its... something obvious - but I haven't been able to get it right.
Besides whitelisting the process, you need to define the PROCESSNAME value in the measure.

Code: Select all

[MeasureOnlyVlc]
Measure=Process
ProcessName=vlc.exe
Whitelist=vlc
IfCondition=(MeasureOnlyVlc = 1)
IfTrueAction=[!SetOption CentreText Text ""[MeasureActiveTitle]""][!SetOption CentreTextVisible Text ""[MeasureActiveTitle]""][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption CentreText Text "VLC INACTIVE"][!SetOption CentreTextVisible Text "VLC INACTIVE"]
IfConditionMode=1
DynamicVariables=1
You may want to use Substitute instead of IfCondition tests, then use the [MeasureOnlyVlc] as the Measurename in your string meters.

Code: Select all

[MeasureOnlyVlc]
Measure=Process
ProcessName=vlc.exe
Substitute="-1":"VLC INACTIVE","1":"[*MeasureActiveTitle*]"
User avatar
SilverAzide
Rainmeter Sage
Posts: 2613
Joined: March 23rd, 2015, 5:26 pm

Re: Using UsageMonitor stste to toggle output to a string.

Post by SilverAzide »

CodeCode wrote: December 9th, 2023, 12:34 am Its... something obvious - but I haven't been able to get it right.
Part of the problem is you seem to have the UsageMonitor plugin and the Process measures mixed up.
Gadgets Wiki GitHub More Gadgets...
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Using UsageMonitor stste to toggle output to a string.

Post by eclectic-tech »

SilverAzide wrote: December 9th, 2023, 1:29 am Part of the problem is you seem to have the UsageMonitor plugin and the Process measures mixed up.
Yes, good catch. I overlooked that 'whitelist' is a UsageMonitor parameter and does nothing in a Process measure... My Bad :Whistle
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using UsageMonitor stste to toggle output to a string.

Post by CodeCode »

Hmm. LOL. I definitely crossed Measure Options.

This is what I wound up using:

Code: Select all

[MeasureOnlyVlc]
Measure=PlugIn
PlugIn=Process
ProcessName=vlc.exe
Substitute="-1":"VLC INACTIVE","1":"[&MeasureActiveTitle]"
DynamicVariables=1
Is there a way I could prevent other active titles from showing. That is what happens when vlc is running. The upside is if vlc is not running the VLC INACTIVE output works and nothing else.

Is there a way for Usage Monitor to do this? I tried a couple options - syntax and what to use. The catch might be that I don't know if Alias is mandatory, or what to put there if it is mandatory.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Using UsageMonitor stste to toggle output to a string.

Post by eclectic-tech »

CodeCode wrote: December 9th, 2023, 2:09 am Hmm. LOL. I definitely crossed Measure Options.

This is what I wound up using:

Code: Select all

[MeasureOnlyVlc]
Measure=PlugIn
PlugIn=Process
ProcessName=vlc.exe
Substitute="-1":"VLC INACTIVE","1":"[&MeasureActiveTitle]"
DynamicVariables=1
Is there a way I could prevent other active titles from showing. That is what happens when vlc is running. The upside is if vlc is not running the VLC INACTIVE output works and nothing else.

Is there a way for Usage Monitor to do this? I tried a couple options - syntax and what to use. The catch might be that I don't know if Alias is mandatory, or what to put there if it is mandatory.
You can disable the [MeasureActiveTitle] measure if vlc is not active. This will cause the value to "pause" on the last active title, so you may need to use your alternate method of setting the value of the 'Text' in the meters instead of having the MeasureName control the text.

Code: Select all

[MeasureOnlyVlc]
Measure=PlugIn
PlugIn=Process
ProcessName=vlc.exe
IfCondition=MeasureOnlyVlc = 1
IfTrueAction=[!EnableMeasure MeasureActiveTitle][!UpdateMeasure MeasureActiveTitle][!SetOption CentreText Text ""[MeasureActiveTitle]""][!SetOption CentreTextVisible Text ""[MeasureActiveTitle]""][!UpdateMeter *][!Redraw]
IfFalseAction=[!DisableMeasure MeasureActiveTitle][!SetOption CentreText Text "VLC INACTIVE"][!SetOption CentreTextVisible Text "VLC INACTIVE"]
IfConditionMode=1
DynamicVariables=1
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using UsageMonitor stste to toggle output to a string.

Post by CodeCode »

eclectic-tech wrote: December 9th, 2023, 2:56 am You can disable the [MeasureActiveTitle] measure if vlc is not active. This will cause the value to "pause" on the last active title, so you may need to use your alternate method of setting the value of the 'Text' in the meters instead of having the MeasureName control the text.

Code: Select all

[MeasureOnlyVlc]
Measure=PlugIn
PlugIn=Process
ProcessName=vlc.exe
IfCondition=MeasureOnlyVlc = 1
IfTrueAction=[!EnableMeasure MeasureActiveTitle][!UpdateMeasure MeasureActiveTitle][!SetOption CentreText Text ""[MeasureActiveTitle]""][!SetOption CentreTextVisible Text ""[MeasureActiveTitle]""][!UpdateMeter *][!Redraw]
IfFalseAction=[!DisableMeasure MeasureActiveTitle][!SetOption CentreText Text "VLC INACTIVE"][!SetOption CentreTextVisible Text "VLC INACTIVE"]
IfConditionMode=1
DynamicVariables=1
That's pretty cool.

In the meantime I came up with this:

Code: Select all

[MeasureOnlyVlc]
Measure=Plugin
Plugin=UsageMonitor
Alias=CPU
Name=vlc
WhiteList=vlc
Index=1
IfCondition=MeasureOnlyVlc > 0
IfTrueAction=[!ShowMeterGroup MovieTitle][!SetOption CentreText Text [&MeasureActiveTitle]][!SetOption CentreTextVisible Text [&MeasureActiveTitle]][!Update]
IfFalseAction=[!SetOption CentreText Text ""][!SetOption CentreTextVisible Text ""][!HideMeterGroup MovieTitle][!Update]
It seems to work great, but the Meter group does not seems to want to stay on, so the group disappears and appears randomly? not sure as the read might be counting in bursts to provide a smooth playback - so the value goes to 0 then up, to 0 rinse repeat.

Is there a way around that?
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using UsageMonitor stste to toggle output to a string.

Post by CodeCode »

Bah. Never Mind that idea. I just improvised to this:

Code: Select all

[MeasureOnlyVlc]
Measure=PlugIn
PlugIn=Process
ProcessName=vlc.exe
Substitute="-1":"VLC INACTIVE","1":"[&MeasureActiveTitle]"
IfCondition=MeasureOnlyVlc = 1
IfTrueAction=[!ShowMeterGroup MovieTitle][!Update]
IfFalseAction=[!HideMeterGroup MovieTitle][!Update]
DynamicVariables=1
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using UsageMonitor stste to toggle output to a string.

Post by CodeCode »

Final Version (I think).

Code: Select all

[MeasureOnlyVlc]
Measure=PlugIn
PlugIn=Process
ProcessName=vlc.exe
Substitute="-1":"Title","1":"[&MeasureActiveTitle]"
DynamicVariables=1
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 16177
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Using UsageMonitor stste to toggle output to a string.

Post by balala »

This might seem a nitpick, but don't intend it to be. But Process is not anymore a plugin, meantime it has been converted to an internal measure. It should be used accordingly, by replacing the Measure=PlugIn and PlugIn=Process options by Measure=Process.