I've tried many many variations with and without the Substitute, please can someone put me out of my misery
It is currently March 28th, 2024, 8:41 am
Replace text
Replace text
Ok, I give up! I'm trying to detect if WiFi is connected or not and show the relevant icon, but it refuses to work.
I've tried many many variations with and without the Substitute, please can someone put me out of my misery
I've checked both the manual and the 'About/Skins' window to see what the 'String' is and still I just don't understand what I'm doing wrong!
I've tried many many variations with and without the Substitute, please can someone put me out of my misery
- jsmorley
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Replace text
Try this:
IfMatch does not have a "test what?" parameter like IfCondition does. It is based on the string value of the measure it is on.
Also, "quotes" are not required around the regular expression you are testing with.
So it's not IfMatch=mSSID="-1", but rather IfMatch=-1
Code: Select all
[mSSID]
Measure=Plugin
Plugin=WiFiStatus
WiFiInfoType=SSID
IfMatch=-1
IfMatchAction=[!SetOption WiFiIcon Text "[\xEB5E]"] [!UpdateMeter *] [!Redraw]
IfNotMatchAction=[!SetOption WiFiIcon Text "[\xE701]"] [!UpdateMeter *] [!Redraw]
DynamicVariables=1
Also, "quotes" are not required around the regular expression you are testing with.
So it's not IfMatch=mSSID="-1", but rather IfMatch=-1
Re: Replace text
Thank you! Thank you! Thank you!
And it works with the Substitute too...
And it works with the Substitute too...
- jsmorley
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Replace text
Ok, not sure I see any point for the Substitute, but maybe you are using the string value somewhere else. Also, don't enclose the regular expression in "quotes". They are not needed, and are just thrown away by Rainmeter.
Re: Replace text
Ah, yes, the substitute is used in another meter.
Regarding quotes, it's never clear when I should or shouldn't use them. Mostly things are copied from old skins I have and new features added as I learn, but things like this get copied too.
Thanks for your help.
Regarding quotes, it's never clear when I should or shouldn't use them. Mostly things are copied from old skins I have and new features added as I learn, but things like this get copied too.
Thanks for your help.
Last edited by sl23 on August 20th, 2021, 6:35 am, edited 1 time in total.
- jsmorley
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Replace text
Glad to help. In most cases, quotes where they are not needed is not a problem. But in short the rule is:sl23 wrote: ↑August 19th, 2021, 10:46 pm Ah, yes, the substitute is used in another meter.
Regarding quotes, it's never clear when I should or shouldn't use them. Mmptjw things are copied from old skins I have and new features added as I learn, but things like this get copied too.
Thanks for your help.
Never use quotes at the beginning and end of any option value. They are never needed, and always thrown away. Substitute is the single special case.
- Yincognito
- Rainmeter Sage
- Posts: 7017
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Replace text
And bangs, if I'm not mistaken (when you intend that value to be a string and to be sure spaces are handled properly).
P.S. Just re-read you post, you were talking about option values, where Substitute is indeed the only case. But then, I guess it doesn't hurt to expand the details to the whole Rainmeter system though, at least for informative purposes.
- jsmorley
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Replace text
https://forum.rainmeter.net/viewtopic.php?f=118&t=27870Yincognito wrote: ↑August 20th, 2021, 1:03 pm And bangs, if I'm not mistaken (when you intend that value to be a string and to be sure spaces are handled properly).
P.S. Just re-read you post, you were talking about option values, where Substitute is indeed the only case. But then, I guess it doesn't hurt to expand the details to the whole Rainmeter system though, at least for informative purposes.
- Yincognito
- Rainmeter Sage
- Posts: 7017
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Replace text
Indeed.
Re: Replace text
Excellent, thanks for the info and the link.
Need to revise a bit on that |