It is currently April 24th, 2024, 9:33 pm

IfMatch doesn't work...

Get help with creating, editing & fixing problems with skins
User avatar
tass_co
Posts: 517
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

IfMatch doesn't work...

Post by tass_co »

Hi,

Where am I doing wrong? :(
When string is false i want to show meter. (MeaItem/#LastOne#)

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
LastOne=Example1

[Feed]
Measure=WebParser
URL=file://C:\Users\Documents\Rainmeter\Skins\TRU\tru.txt
RegExp=(?siU)<a href=".*">(.*)</a>
UpdateRate=6

[MeaItem]
Measure=Plugin
Plugin=WebParser
Url=[Feed]
StringIndex=1

[MtrStar]
Meter=Image
ImageName=cap.png
x=0
y=0
W=50
H=50
LeftMouseDoubleClickAction=[!SetClip "[MeaItem]"][!WriteKeyValue Variables LastOne [MeaItem]][!Refresh]
Hidden=1
Group=CHK
DynamicVariables=1

[Item1]
Meter=String
X=0
Y=40
H=40
W=4
StringStyle=Normal
StringEffect=Shadow
StringAlign=Left
FontSize=9
FontFace=Clockopia
FontColor=255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=#LastOne#
Group=CHK
Hidden=1
DynamicVariables=1

[Item2]
Meter=String
MeasureName=MeaItem
X=0
Y=54
H=40
W=4
StringStyle=Normal
StringEffect=Shadow
StringAlign=Left
FontSize=9
FontFace=Clockopia
FontColor=255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Hidden=1
Group=CHK
DynamicVariables=1


[MeaCheck]
Measure=String
String=[MeaItem]
IfMatchMode=1
IfMatch=[#*LastOne*]
IfMatchAction=[!HideMeterGroup CHK][!UpdateMeterGroup CHK][!Redraw]
IfNotMatchAction=[!ShowMeterGroup CHK][!UpdateMeterGroup CHK][!Redraw]
DynamicVariables=1
tru.txt file

Code: Select all

Example1
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfMatch doesn't work...

Post by balala »

tass_co wrote: April 15th, 2022, 1:05 pm Where am I doing wrong? :(
When string is false i want to show meter. (MeaItem/#LastOne#)
And what is wrong? Because it works for me. Check the encoding of the tru.txt file. It should be UTF-8, however I believe not this is the problem. So what is not working? Even if the strings doesn't match, the meters are not shown?
User avatar
tass_co
Posts: 517
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: IfMatch doesn't work...

Post by tass_co »

balala wrote: April 15th, 2022, 6:29 pm And what is wrong? Because it works for me. Check the encoding of the tru.txt file. It should be UTF-8, however I believe not this is the problem. So what is not working? Even if the strings doesn't match, the meters are not shown?
I dont know balala.
"tru.txt" file was saved in UTF-8 format.
Meters are not visible even if IfMatch is true/false
16-04-2022 00_13_01-About Rainmeter.png
PS: I mistyped the tru.txt file content.

Code: Select all

(?siU)<a href=".*">Example1</a>
You do not have the required permissions to view the files attached to this post.
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfMatch doesn't work...

Post by balala »

tass_co wrote: April 15th, 2022, 9:16 pm PS: I mistyped the tru.txt file content.
So is it working now, with the fixed file content?
User avatar
tass_co
Posts: 517
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: IfMatch doesn't work...

Post by tass_co »

balala wrote: April 16th, 2022, 9:20 am So is it working now, with the fixed file content?
It doesn't work, balala.
Probably, i doing something wrong but i dont know what...
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfMatch doesn't work...

Post by balala »

tass_co wrote: April 16th, 2022, 9:53 am It doesn't work, balala.
Ok, please pack the whole TRU config (if I'm not mistaken this is your config, right?) and upload the package here, to can check it.
User avatar
tass_co
Posts: 517
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: IfMatch doesn't work...

Post by tass_co »

balala wrote: April 16th, 2022, 10:23 am Ok, please pack the whole TRU config (if I'm not mistaken this is your config, right?) and upload the package here, to can check it.
tru_.rmskin
You do not have the required permissions to view the files attached to this post.
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfMatch doesn't work...

Post by balala »

tass_co wrote: April 16th, 2022, 10:52 amtru_.rmskin
Try replacing the IfMatch option of the [MeaCheck] measure with the following one: IfMatch=^#LastOne#$. The added ^ and $ characters are used to tell Rainmeter that the #LastOne# variable has to match the complete value of the [MeaCheck] measure. Without these characters, if the value of the #LastOne# variable is contained in the value of the [MeaCheck] measure, but it's not the whole string of the measure, the match still goes on and the IfMatchAction is executed, while IfNotMatchAction isn't.
And exactly this is the case in your example: the measure returns Example12 (based on the content of the tru1.txt file), while the #LastOne# variable is Example1. This variable matches what the measure returns (in fact it is contained into the value of the measure), even if not the whole value of the measure.

Additional note: it is not a good idea to use a complete and exact path of a file. The C:\Users\Hasan Tahsin\Documents\Rainmeter\Skins\TRU\tru1.txt path can be used only on your computer, it doesn't work on any other (neither on mine) (used in the URL option of the [Feed] measure). Recommend to use some built-in variables in this path. For instance any of the following options work:
  • URL=file://#CURRENTPATH#tru1.txt
  • URL=file://#SKINSPATH#TRU\tru1.txt
  • URL=file://#SKINSPATH##CURRENTCONFIG#\tru1.txt
This way you ensure your skin will be usable by others as well on their own computer, without having to edit the path.
User avatar
tass_co
Posts: 517
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: IfMatch doesn't work...

Post by tass_co »

balala wrote: April 16th, 2022, 2:27 pm Try replacing the IfMatch option of the [MeaCheck] measure with the following one: IfMatch=^#LastOne#$. The added ^ and $ characters are used to tell Rainmeter that the #LastOne# variable has to match the complete value of the [MeaCheck] measure. Without these characters, if the value of the #LastOne# variable is contained in the value of the [MeaCheck] measure, but it's not the whole string of the measure, the match still goes on and the IfMatchAction is executed, while IfNotMatchAction isn't.
And exactly this is the case in your example: the measure returns Example12 (based on the content of the tru1.txt file), while the #LastOne# variable is Example1. This variable matches what the measure returns (in fact it is contained into the value of the measure), even if not the whole value of the measure.

Additional note: it is not a good idea to use a complete and exact path of a file. The C:\Users\Hasan Tahsin\Documents\Rainmeter\Skins\TRU\tru1.txt path can be used only on your computer, it doesn't work on any other (neither on mine) (used in the URL option of the [Feed] measure). Recommend to use some built-in variables in this path. For instance any of the following options work:
  • URL=file://#CURRENTPATH#tru1.txt
  • URL=file://#SKINSPATH#TRU\tru1.txt
  • URL=file://#SKINSPATH##CURRENTCONFIG#\tru1.txt
This way you ensure your skin will be usable by others as well on their own computer, without having to edit the path.
One last question.
How can I support different language characters?
example: & => &amp or г => г
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfMatch doesn't work...

Post by balala »

tass_co wrote: April 16th, 2022, 2:54 pm One last question.
How can I support different language characters?
example: & => &amp or г => г
Try adding a DecodeCharacterReference=1 option to the WebParser measure which returns the value (so in this case to the [MeaItem] measure).