Page 1 of 1

IfMatch statement

Posted: November 17th, 2022, 4:11 pm
by Jaime Méndez
Hi!

Please, if someone can help.

I am just about to release final skin version, but there is still one issue.
I don't find a way to have "LeftMouseUpAction" within an "IfMatchAction" statement

Here is the pise of code involved and the whole skin:
https://forum.rainmeter.net/viewtopic.php?p=211224#p211224

Thank you fellows!

Re: IfMatch statement

Posted: November 17th, 2022, 6:39 pm
by SilverAzide
Jaime Méndez wrote: November 17th, 2022, 4:11 pm Hi!

Please, if someone can help.

I am just about to release final skin version, but there is still one issue.
I don't find a way to have "LeftMouseUpAction" within an "IfMatchAction" statement

Here is the pise of code involved and the whole skin:
https://forum.rainmeter.net/viewtopic.php?p=211224#p211224

Thank you fellows!
There's nothing wrong with the IfMatch. What's wrong is that your !SetOption commands in the actions are completely mangled. Your triple-quotes are unbalanced (and may be unneeded) and your usage of asterisks is not correct either. I'd suggest reviewing the docs on how to escape variables and section references.

Re: IfMatch statement

Posted: November 17th, 2022, 6:50 pm
by balala
SilverAzide wrote: November 17th, 2022, 6:39 pm Your triple-quotes are unbalanced (and may be unneeded)
In fact, only one single pair of triple-quote can be used into one bang. If there are more, the value which will be set is from the first triple-quote up to the next one. All rest is ignored. This is what I described in my last reply, posted in the appropriate topic.

Re: IfMatch statement

Posted: November 17th, 2022, 8:03 pm
by Jaime Méndez
Ok. Now it is working, but only for the first file or folder icon (second tile in row)

Code: Select all

IfMatch=^$
IfMatchAction=[!SetOption MeterTileSelection%% LeftMouseUpAction """[!CommandMeasure mFilePath%% "FollowPath"][!SetVariable Path "[*mPath*]"][!UpdateMeasure mPath][!CommandMeasure "ScriptFactoryTiles" "Run((#*Amount*#-1))"][!CommandMeasure "ScriptRefresher" "Run()"][!Refresh]"""]
IfNotMatchAction=[!SetOption MeterTileSelection%% LeftMouseUpAction """[!CommandMeasure mFilePath%% "FollowPath"]"""]
"leftmouseupclick" on next tiles does nothing. I have checked "#@#include\tile.inc" file and it has been built ok. I should work

From index 1 to 19, all have been built on file

Code: Select all

IfMatch=^$
IfMatchAction=[!SetOption MeterTileSelection2 LeftMouseUpAction """[!CommandMeasure mFilePath2 "FollowPath"][!SetVariable Path "[*mPath*]"][!UpdateMeasure mPath][!CommandMeasure "ScriptFactoryTiles" "Run((#*Amount*#-1))"][!CommandMeasure "ScriptRefresher" "Run()"][!Refresh]"""]
IfNotMatchAction=[!SetOption MeterTileSelection2 LeftMouseUpAction """[!CommandMeasure mFilePath2 "FollowPath"]"""]

Re: IfMatch statement

Posted: November 17th, 2022, 8:18 pm
by balala
Jaime Méndez wrote: November 17th, 2022, 8:03 pm From index 1 to 19, all have been built on file
On which measures have you added those IfMatch options?

Re: IfMatch statement

Posted: November 17th, 2022, 8:33 pm
by Jaime Méndez
balala wrote: November 17th, 2022, 8:18 pm On which measures have you added those IfMatch options?
There is a lua script that generates the "tiles.inc" using "tiles.inc.template" file in "include" folder. You don´t need to check over the lua script, you just need to see how tile.inc is rendering tiles in skin. What i see is that it should be working for all folder and file tiles :???:

Re: IfMatch statement

Posted: November 17th, 2022, 11:26 pm
by Jaime Méndez
I found the error!

There was a "%%" missing in measure name in "tiles.inc.template"

Measure name

Code: Select all

[MeasureFileSize]
should contain "%%" anywhere in its name

Code: Select all

[MeasureFileSize%%]
so the whole measure section repeats any times needed until 19 to acompain meter to be set with "IfMatchAction" "!SetOption" instruction

Code: Select all

[MeasureFileSize%%]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Index=%%
Type=FileSize
IfMatch=^$
IfMatchAction=[!SetOption MeterTileSelection%% LeftMouseUpAction """[!CommandMeasure mFilePath%% "FollowPath"][!SetVariable Path "[*mPath*]"][!UpdateMeasure mPath][!CommandMeasure "ScriptFactoryTiles" "Run((#*Amount*#-1))"][!CommandMeasure "ScriptRefresher" "Run()"][!Refresh]"""]
IfNotMatchAction=[!SetOption MeterTileSelection%% LeftMouseUpAction """[!CommandMeasure mFilePath%% "FollowPath"]"""]
It is working as a charm now!

Thankyou again guys! :beer: I debt you a beer

Posting it now!

Re: IfMatch statement

Posted: November 18th, 2022, 8:18 pm
by balala
Jaime Méndez wrote: November 17th, 2022, 11:26 pm It is working as a charm now!
Glad you got it working.
But what you mean by Index=%% on the [MeasureFileSize%%] measure?

Re: IfMatch statement

Posted: November 18th, 2022, 10:02 pm
by Jaime Méndez
This text chain "%%" is present only in a template file that isn't really part of skin structure, but it is needed for a "lua" script file that generates the real final "inc" file that form part of the skin. Script substitutes "%%" for a index number "n" times, so measures and meters repeat indexed "n" times in final "inc" file.
I hope I made myself clear

Re: IfMatch statement

Posted: November 19th, 2022, 6:37 pm
by balala
Jaime Méndez wrote: November 18th, 2022, 10:02 pm I hope I made myself clear
Yep, you did.