It is currently May 3rd, 2024, 8:21 am

Trouble with []. Can't keep it straight

Get help with creating, editing & fixing problems with skins
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Trouble with []. Can't keep it straight

Post by Codger »

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.
On my way. IfConditions sounds like a winner. Thank you sir.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Trouble with []. Can't keep it straight

Post by Codger »

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.
I ran in a slight snag and while I got around it I just wanted to make sure I had the right culprit.
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
Works like a charm. Thank you very much. Hopefully I'll be much more on my game tomorrow.
A couple more hours hopefully not making a horrible mess then a full days sleep and I'll be ready for action.
:welcome:
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trouble with []. Can't keep it straight

Post by jsmorley »

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.
You can have any number of any mix of IfMatch and IfCondition on the same measure.
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Trouble with []. Can't keep it straight

Post by Codger »

jsmorley wrote:You can have any number of any mix of IfMatch and IfCondition on the same measure.
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 :?

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. 8-)
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
User avatar
balala
Rainmeter Sage
Posts: 16195
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trouble with []. Can't keep it straight

Post by balala »

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.
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.
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Trouble with []. Can't keep it straight

Post by Codger »

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.
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.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
User avatar
balala
Rainmeter Sage
Posts: 16195
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trouble with []. Can't keep it straight

Post by balala »

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.
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?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trouble with []. Can't keep it straight

Post by jsmorley »

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 :?
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:

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.
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Trouble with []. Can't keep it straight

Post by Codger »

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?
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.

Thanks again.
[hr][/hr][hr][/hr]
"If you are the smartest one in the room, you are in the wrong room."
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Trouble with []. Can't keep it straight

Post by Codger »

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.
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.

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."