It is currently July 27th, 2021, 2:20 pm

[BUG?] in Multiple usage of #CURRENTSECTION#

Report bugs with the Rainmeter application and suggest features.
User avatar
Active Colors
Moderator
Posts: 807
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Active Colors »

Yincognito wrote: June 30th, 2021, 9:26 pm Well, ActiveColors wanted short stuff, I gave him what he wanted... :lol:

Other than that, who cares what they are used for? The next generation already cares only whether things look nice, even less whether they work, and almost no concern for the "essence", so, no problem for a civilization of consumers... :???:
P.S. Maybe you didn't see this. Pretend you don't know who's the author. :sly:
Man, I wanted it shorten it but in some understandable way ahaha. It is not that I optimize and simplify code by the number of characters, but the number of repetitions. In this manner it does not really matter how a variable is called, whether it is #INDEX# or #RETRIVEINDEXOFCURRENTSECTION# because they do the exact same thing. I simply wanted to have some short form to make it comfy while coding, and leave understandable for other people, hence #INDEX# is gucci. After two days I myself will forget what V P B G I X stand for phahaha. Simply #INDEX# is enough really. Thanks for the suggestions, I always love to discuss simplification methods :thumbup:

And I am really grateful that you dedicated your time to create current section index method and maintaining it throughout the updates. Without it my code would look like this (my actual code from the past):
rm2.png
rm1.png
rm4.png
Also, something simple can almost never be achieved simply. If something looks simple it was hard to make. In order to achieve simplicity and utility some healthy balance of complexity must be reached. Ying and Yang.
We have already gone far from the original issue so I am going to go even further and leave some music here related to simplicity https://www.youtube.com/watch?v=BYSqr-Zkn6A
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 3644
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Yincognito »

Active Colors wrote: June 30th, 2021, 9:56 pmMan, I wanted it shorten it but in some understandable way ahaha. It is not that I optimize and simplify code by the number of characters, but the number of repetitions.
I know - it was just, well, let's call it an "exercise in simplification". :D For sure too much, but it was meant to be only a showcase, and a fitting conclusion of what works (at least we have 3 choices, right?).
Active Colors wrote: June 30th, 2021, 9:56 pmWithout it my code would look like this (my actual code from the past)
Ouch, that code is crazy! :jawdrop I thought I was doing 1 km lines, but that is ... out of this world. Glad my 6 line Lua code helped with that. :great:
Thanks for the music, by the way - really interesting. Now I feel like in the 30th century, surrounded by AI robots and stuff, hahaha!
User avatar
death.crafter
Posts: 501
Joined: April 24th, 2021, 8:13 pm

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by death.crafter »

Yincognito wrote: June 30th, 2021, 9:26 pm Well, ActiveColors wanted short stuff, I gave him what he wanted... :lol:

Other than that, who cares what they are used for? The next generation already cares only whether things look nice, even less whether they work, and almost no concern for the "essence", so, no problem for a civilization of consumers... :???:
P.S. Maybe you didn't see this. Pretend you don't know who's the author. :sly:
LMAO... ActiveColors is OP :rofl:

But the way you handled the regex is on another level, I have to give you that.
from the Realm of Death
My Current Desktop
User avatar
Yincognito
Rainmeter Sage
Posts: 3644
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Yincognito »

death.crafter wrote: July 1st, 2021, 4:48 amBut the way you handled the regex is on another level, I have to give you that.
Only trying to match both the V2 and V3 versions of the weather.com JSON with the same regex was a bit of a challenge, the rest was just structuring its parts into variables (the subject of this thread, by the way) so I don't have to paste miles long lines from measure to measure. These variables are realy useful in Rainmeter to shorten things up.
User avatar
Brian
Developer
Posts: 2210
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Brian »

Ok. I think I made some progress on this.

Here is a special build for everyone to try:

Rainmeter.zip

I still have some testing to do, but my early tests seem to work.

-Brian
You do not have the required permissions to view the files attached to this post.
User avatar
Active Colors
Moderator
Posts: 807
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Active Colors »

Brian wrote: July 1st, 2021, 2:32 pm Ok. I think I made some progress on this.

Here is a special build for everyone to try:


Rainmeter.zip


I still have some testing to do, but my early tests seem to work.

-Brian

The examples which demonstrated the issue with escaped [#*CURRENTSECTION*]in Variables here and here are working properly now.
Also, I haven't noticed that this fix caused other parts to break on my side.
Will be doing more tests overtime as well.
Thanks Brian for the hard work!

EDIT:
This problem is now gone too. Yincognito, could you confirm this?
User avatar
death.crafter
Posts: 501
Joined: April 24th, 2021, 8:13 pm

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by death.crafter »

Brian wrote: July 1st, 2021, 2:32 pm Ok. I think I made some progress on this.

Here is a special build for everyone to try:


Rainmeter.zip


I still have some testing to do, but my early tests seem to work.

-Brian
Holy crap! You fixed it in no time.

Can you explain what was wrong and what did you do to fix it?

Thanks for the hard work
and sorry for making you work relentlessly on new bugs. It' been 5 builds including this already this month, starting June 20
from the Realm of Death
My Current Desktop
User avatar
Yincognito
Rainmeter Sage
Posts: 3644
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Yincognito »

Brian wrote: July 1st, 2021, 2:32 pmHere is a special build for everyone to try...
Amazing, Brian! :rosegift: :rosegift: :rosegift:
Everything I tested thus far works - now we can use

Code: Select all

[Variables]
CURRENTSECTIONINDEX=[&Script:SectionIndex('[#*CURRENTSECTION*]','last','(<x>)')]
and it works EVERYWHERE (options, bangs, etc). You, my friend, are a genius! Thank you!!! :bow:

The only thing that "doesn't work" are the initial harmless errors at refresh time, when the result of the Lua function is 0:

Code: Select all

[Variables]
CURRENTSECTIONINDEX=[&Script:SectionIndex('[#*CURRENTSECTION*]','last','(<x>)')]
; Alternative using inline Lua: [&Script:SectionIndex('[#CURRENTSECTION]','last','(<x>)')]

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

---Measures---

[Script]
Measure=Script
ScriptFile=#@#Scripts\Script.lua
UpdateDivider=-1

---Meters---

[Background]
Meter=Image
W=100
H=100
SolidColor=255,0,0,255

[ObjIcon1]
Meter=Image
X=1
; a random 32 x 32 PNG
ImageName=#@#Images\a.png

[ObjDistance1]
Meter=Image

; These below used in a (formula) will produce harmless initial errors at skin refresh time
X=([&ObjIcon[#CURRENTSECTIONINDEX]:XW])
; X=([&ObjIcon[&Script:SectionIndex('[#CURRENTSECTION]','last','(<x>)')]:XW])
; X=([&ObjIcon[&Script:SectionIndex('ObjDistance1','last','(<x>)')]:XW])

; These below not in a (formula) won't produce harmless initial errors at skin refresh time
; X=[&ObjIcon[#CURRENTSECTIONINDEX]:XW]
; X=[&ObjIcon[&Script:SectionIndex('[#CURRENTSECTION]','last','(<x>)')]:XW]
; X=[&ObjIcon[&Script:SectionIndex('ObjDistance1','last','(<x>)')]:XW]

W=5
H=5
SolidColor=255,255,0,255
UpdateDivider=-1
DynamicVariables=1
But then, this is, as I said, harmless and it doesn't affect functionality in any way, and actually never did. It's the equivalent of a Time measure throwing an error at refresh time in certain conditions, to make an accurate comparison.
User avatar
Active Colors
Moderator
Posts: 807
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Active Colors »

death.crafter wrote: July 1st, 2021, 3:02 pm
and sorry for making you work relentlessly on new bugs. It' been 5 builds including this already this month, starting June 20
Brian is gangsta 8-)
If somebody will be traveling to Berlin the drinks are on me to celebrate this 🥥
User avatar
Yincognito
Rainmeter Sage
Posts: 3644
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG?] in Multiple usage of #CURRENTSECTION#

Post by Yincognito »

Active Colors wrote: July 1st, 2021, 2:51 pmEDIT:
This problem is now gone too. Yincognito, could you confirm this?
Yes, this works as well now - as I said, every f...ing thing works. :lol: :great:
Hopefully it won't break something else entirely, so fingers crossed.
death.crafter wrote: July 1st, 2021, 3:02 pmCan you explain what was wrong and what did you do to fix it?
Thanks for the hard work
and sorry for making you work relentlessly on new bugs. It' been 5 builds including this already this month, starting June 20
Same here. So yes, Brian, please do - it would be interesting to find out what exactly was the issue and the solution.