It is currently April 18th, 2024, 3:37 am

Single RunCommand measure to two meters

Get help with creating, editing & fixing problems with skins
JohnE
Posts: 4
Joined: October 21st, 2019, 1:22 pm

Single RunCommand measure to two meters

Post by JohnE »

Hi, I have been looking to find a way to run a command once and then split the output and use it in two locations.

I was hoping that RegExpSubstitute and Substitute would work on two string meters that use the same measure, but the substitute only seems to work on the measure.

This is an example where measureTime returns two times separated by | as in 13:50|88:34:10. I would like to run the measure once and use the output in two meters, but the substitute seems to be ignored.

Code: Select all

[meterTime1]
Meter=STRING
MeterStyle=styleRightText
MeasureName=measureTime
X=200
Y=100
W=190
H=14
DynamicVariables=1
RegExpSubstitute=1
Substitute="(.*)|":"\1"

[meterTime2]
Meter=STRING
MeterStyle=styleRightText
MeasureName=measureTime
X=200
Y=200
W=190
H=14
DynamicVariables=1
RegExpSubstitute=1
Substitute=".*|(.*)":"\1"
Is this possible?

Many thanks
Last edited by balala on February 11th, 2020, 6:16 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are you posting code snippets. It's the </> button.
User avatar
Jeff
Posts: 327
Joined: September 3rd, 2018, 11:18 am

Re: Single RunCommand measure to two meters

Post by Jeff »

Substitution only works on measures, that's why it's in the General Options in measures (duh)
You can just make 2 measures which you substitute and then MeasureName them on the meter, though we're missing other info, what does the RunCommand measure/plugin even do in your example? What do the measureTimes even do? Not enough info to help
JohnE
Posts: 4
Joined: October 21st, 2019, 1:22 pm

Re: Single RunCommand measure to two meters

Post by JohnE »

Thanks for your quick response. I was just trying to avoid running the #RMTMR# twice. It is a custom app that returns two timers from two different sources.

I was trying to change this

Code: Select all

[measureTLoc2]
Measure=Plugin
Plugin=RunCommand
Program="#RMTMR#"
Parameter=""#sens2ID#" "#TimeFormat#""
State=Hide
OutputType=ANSI

[measureTLoc3]
Measure=Plugin
Plugin=RunCommand
Program="#RMTMR#"
Parameter=""#sens3ID#" "#TimeFormat#""
State=Hide
OutputType=ANSI
To this

Code: Select all

[measureTLoc3]
Measure=Plugin
Plugin=RunCommand
Program="#RMTMR#"
Parameter=""#sens2ID#" "#sens3ID#" "#TimeFormat#""
State=Hide
OutputType=ANSI
Unless two measures can use the single measure a source...It's not really a calc I need which looks like it could handle it with numbers, its more for string handling as I may want to add some other information to the output of the app.

The other option would be to output to a file and then use a Webparser to a local file. Just trying to keep it simple..ish, so I may take that route.
Last edited by balala on February 11th, 2020, 6:16 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are you posting code snippets. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 16143
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Single RunCommand measure to two meters

Post by balala »

It is extremely hard for anyone to offer help, if you don't help us to help you. For instance:
JohnE wrote: February 11th, 2020, 5:21 pm This is an example where measureTime returns two times separated by | as in 13:50|88:34:10. I would like to run the measure once and use the output in two meters, but the substitute seems to be ignored.
Which "this"? Where is the measure in cause?
Another one:
JohnE wrote: February 11th, 2020, 6:01 pm I was just trying to avoid running the #RMTMR# twice. It is a custom app that returns two timers from two different sources.
What exactly #RMTMR# is? Who can tell what it does, if we don't even know what that program is. Even better would be to have the program, but at least to know its name would be essencial.
So, first please pack the whole config you have and upload the package (include the program, as much as possible). This way we could replicate the results.
User avatar
Jeff
Posts: 327
Joined: September 3rd, 2018, 11:18 am

Re: Single RunCommand measure to two meters

Post by Jeff »

As a quick fix before anyone thinks of a method, use InLineSettings to acomplish this

Code: Select all

InlineSetting=Size | 0
InlinePattern=(\|.*)
on the first meter and

Code: Select all

InlineSetting=Size | 0
InlinePattern=(.*\|)
on the second meter
(If size dosen't work, try making the size 1 and the color 00000001)
JohnE
Posts: 4
Joined: October 21st, 2019, 1:22 pm

Re: Single RunCommand measure to two meters

Post by JohnE »

Thanks Jeff I will give that a go.

Balala, it is my own code that just outputs some delimited text, the variable #RMTMR# is in an include file pointing to the exe. It doesn't really matter what it returns, I just was trying to get a way to have delimited output to the RunCommand Plugin that I could run once and be able to split the output into two meters. At the moment the exe runs twice for two separate outputs which is not efficient.

Thanks both for responding.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2602
Joined: March 23rd, 2015, 5:26 pm

Re: Single RunCommand measure to two meters

Post by SilverAzide »

JohnE wrote: February 11th, 2020, 10:30 pm At the moment the exe runs twice for two separate outputs which is not efficient.
Jeff's approach can work, but a more brute force way to tackle it is with another set of measures. You still need the original RunCommand measure, but then add a String measure to grab the leading string from the RunCommand result, and another to grab the trailing string. Just a thought... String measures are pretty lightweight, but not as light as none at all.
Gadgets Wiki GitHub More Gadgets...
User avatar
Jeff
Posts: 327
Joined: September 3rd, 2018, 11:18 am

Re: Single RunCommand measure to two meters

Post by Jeff »

I am soooooooooo god damn dumb
On the string measure I read the note as Any combination of hard-coded text, variables, dynamic variables, or section variables are not evaluated in this option. instead of what is actually on the page and that's why I didn't recommend string measures at first.
Add

Code: Select all

[SubstringFirst]
Measure=String
String=[measureTLoc3]
DynamicVariables=1
RegExpSubstitute=1
Substitute="(.*)\|.*":"\1"
[SubstringSecond]
Measure=String
String=[measureTLoc3]
DynamicVariables=1
RegExpSubstitute=1
Substitute=".*\|(.*)":"\1"
somewhere in the code (preferably after that measure) and you just MeasureName them on the time meter strings respectively
(you can get rid of DynamicVariables and do FinishAction=!UpdateMeasures if you want, up to you)
Sorry for my lack of being able to read
Last edited by Jeff on February 12th, 2020, 12:03 am, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Single RunCommand measure to two meters

Post by jsmorley »

ǝuoʎuɐ oʇ uǝddɐɥ uɐɔ ʇᴉ 'ʞo sʇ,I
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Single RunCommand measure to two meters

Post by Mor3bane »

jsmorley wrote: February 11th, 2020, 11:47 pm ǝuoʎuɐ oʇ uǝddɐɥ uɐɔ ʇᴉ 'ʞo sʇ,I
upside-down text looks like Farsi :P
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.