On my way. IfConditions sounds like a winner. Thank you sir.jsmorley wrote:One difference to keep in mind, aside from the obvious that IfMatch is about "matching strings" and IfCondition is about "testing numeric values and formulas", is that IfMatch and IfActions both work on the current value of the measure they are used in. IfConditions is more free-form, in that it supports and requires that the test define both the value you are testing, and the test you are applying to it. So it can be used on any measure, as it is unrelated in a sense to the measure it is on.
It is currently May 3rd, 2024, 8:21 am
Trouble with []. Can't keep it straight
-
- Posts: 97
- Joined: May 29th, 2017, 3:16 pm
Re: Trouble with []. Can't keep it straight
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
-
- Posts: 97
- Joined: May 29th, 2017, 3:16 pm
Re: Trouble with []. Can't keep it straight
I ran in a slight snag and while I got around it I just wanted to make sure I had the right culprit.jsmorley wrote:
IfMatch=SomeRegularExpression
IfCondition=SomeValue=SomeOtherValue
IfMatch will and must use the value and only the string value of the measure it is on as the string to compare to some regular expression.
IfCondition has the additional definition of "SomeValue", which can be any measure, number or formula.
Am I correct in assuming that you can't have differing types of Ifs in the same Measure?
Say, an IfMatch with it's IfMatchAction and later on an IfCondition setup.
I'm actually glad it failed. The final solution looks far less stupid.
Code: Select all
; Update Everything on Switch in Online/Offline Status
; This Section Should Remain Last
[MeasureConnectionChangeCheck]
Measure=String
String=[DetectInternet]
IfMatch=#OnlineStatusLast#
IfNotMatchAction=[!SetVariable OnlineStatusLast [DetectInternet]][!UpdateMeter "MeterInternetStatus"][!UpdateMeasure "DetectInternet"]
IfMatchAction=[!UpdateMeasure "DetectInternet"]
IfMatchMode=1
DynamicVariables=1
UpdateDivider=1
A couple more hours hopefully not making a horrible mess then a full days sleep and I'll be ready for action.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Trouble with []. Can't keep it straight
You can have any number of any mix of IfMatch and IfCondition on the same measure.Codger wrote: Am I correct in assuming that you can't have differing types of Ifs in the same Measure?
Say, an IfMatch with it's IfMatchAction and later on an IfCondition setup.
-
- Posts: 97
- Joined: May 29th, 2017, 3:16 pm
Re: Trouble with []. Can't keep it straight
Good to know for future reference. The trouble, I learned on the next section, was that if you only have one bang you can't put it in []s. Picky pickyjsmorley wrote:You can have any number of any mix of IfMatch and IfCondition on the same measure.
I got a lot done in these last two hours. Funny how some times the easy parts are hard and what I thought would be hard was fairly simple. Once that central structure idea came into place everything fell into place within it. I just have to keep reminding myself to stop thinking top-down.
I'm nearly where I want to be. And then the actual hard part
Good day/night sir.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
-
- Rainmeter Sage
- Posts: 16195
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Trouble with []. Can't keep it straight
I see the discussion following this post, but I have to reply to this.Codger wrote:You say [DetectInternet] never gets updated and then call the !UpdateMeasure "DetectInternet" orphaned. But should not that !UpdateMeasure "DetectInternet" update [DetectInternet] as the UpdateMeasure bang is supposed to override any Updatedivider commands (or so the manual says) thus updating the measure and the following bang displaying the updated value.
In your initial post, you have an, as I said, orphan !UpdateMeasure "DetectInternet" bang, which is not included in any option, just stays after the IfMatchMode=1 option ([MeasureConnectionChangeCheck] measure). Because it is not included in any option, is never executed. That's why I said you probably should move it to the IfNotMatchAction option of the same measure.
-
- Posts: 97
- Joined: May 29th, 2017, 3:16 pm
Re: Trouble with []. Can't keep it straight
That makes perfect sense now. Back then, misconception firmly in mind, I was thinking "He isn't fully reading what I'm typing." I apologize if any of that frustration came across in my replies. With the coding problem being in one of the few areas I felt confident in my perceptions were really thrown off. Thank you for your patience and time.balala wrote:I see the discussion following this post, but I have to reply to this.
In your initial post, you have an, as I said, orphan !UpdateMeasure "DetectInternet" bang, which is not included in any option, just stays after the IfMatchMode=1 option ([MeasureConnectionChangeCheck] measure). Because it is not included in any option, is never executed. That's why I said you probably should move it to the IfNotMatchAction option of the same measure.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
-
- Rainmeter Sage
- Posts: 16195
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Trouble with []. Can't keep it straight
Don't apologize, it happens to all of us. But have you moved the !UpdateMeasure bang where it should be and does the code work now as you wanted?Codger wrote:That makes perfect sense now. Back then, misconception firmly in mind, I was thinking "He isn't fully reading what I'm typing." I apologize if any of that frustration came across in my replies. With the coding problem being in one of the few areas I felt confident in my perceptions were really thrown off. Thank you for your patience and time.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Trouble with []. Can't keep it straight
No, you can, and really should, always enclose bangs in [square brackets], even just one. The reason I say "should", when it's not required with one bang, is that it doesn't hurt, and if you want to add more bangs to the action later it is easier to do so. It's just a good habit, as if the action is an external "command" like LeftMouseUpAction=["calc.exe"] that has leading and trailing "quotes", then it MUST be enclosed in [square brackets], even if just one. So my rule of thumb is:Codger wrote:Good to know for future reference. The trouble, I learned on the next section, was that if you only have one bang you can't put it in []s. Picky picky
1) Always enclose parameters of bangs that CAN includes spaces in "quotes", even if it doesn't this time.
2) Always enclose bangs in [square brackets], even if only one this time.
-
- Posts: 97
- Joined: May 29th, 2017, 3:16 pm
Re: Trouble with []. Can't keep it straight
No, I was still at the "I already talked about this" stage, when some else pointed me toward a workable solution. The final code is upstream here a few messages. It's the one with a checkmark denoting it.balala wrote:Don't apologize, it happens to all of us. But have you moved the !UpdateMeasure bang where it should be and does the code work now as you wanted?
Thanks again.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
-
- Posts: 97
- Joined: May 29th, 2017, 3:16 pm
Re: Trouble with []. Can't keep it straight
I never trust my memory, but in my mind's eye I had the code I was now sure was going to work and didn't quite. And I looked at the lonely bang bracketed as I was going to add more routines later. And I thought "I wonder..." and ALL I did was remove the brackets and voila. But I guess there was some non-script issue that a good refresh, or something else I'm forgetting that tricked me.jsmorley wrote:No, you can, and really should, always enclose bangs in [square brackets], even just one. The reason I say "should", when it's not required with one bang, is that it doesn't hurt, and if you want to add more bangs to the action later it is easier to do so. It's just a good habit, as if the action is an external "command" like LeftMouseUpAction=["calc.exe"] then it MUST be enclosed in [square brackets], even if just one. So my rule of thumb is:
1) Always enclose parameters of bangs that CAN includes spaces in "quotes", even if it doesn't this time.
2) Always enclose bangs in [square brackets], even if only one this time.
Thanks for setting me straight. I'd rather have them all in brackets, single or more. Makes them easier to identify for me.
Thanks again.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."