It is currently April 28th, 2024, 1:18 am

Run WebParser only once?

Get help with creating, editing & fixing problems with skins
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: Run WebParser only once?

Post by Nookz »

with a little bit more thinkering, and thks to your input, I managed to get what I wanted out of it but soon after I binned the whole thing and started from scratch using the steam web api and some filename lookup to get the informations I needed. ^^

Now I've built a bit more functionalities around the concept and I've come across some more issues but I'm solving them along the way, but there's this one that I can't seem to figure out..

I have 2 version of the skin (Ones a tile view, ones a list view). ListView is in a subfolder of the TileView. (because I also want a variant for each)

TileView uses includes like this:
@include=#CURRENTPATH#Extras\NAMEs.inc
@include2=#CURRENTPATH#Extras\IDs.inc
@include3=#CURRENTPATH#Extras\HIDDEN.inc
@include4=#CURRENTPATH#Extras\SteamInfo.inc

ListView uses includes like this:
ParentFolder=#CURRENTPATH#..\
@include=#ParentFolder#Extras\NAMEs.inc
@include2=#ParentFolder#Extras\IDs.inc
@include3=#ParentFolder#Extras\HIDDEN.inc
@include4=#ParentFolder#Extras\SteamInfo.inc

My problem is with ListView, it works fine for all intent and purposes so far except when it comes to using !WriteKeyValue.

Code: Select all

[!WriteKeyValue Variables SkinPosX "#CURRENTCONFIGX#" "#ParentFolder#Extras\SteamInfo.inc"]
I'm getting an 'Illegal Path' error in the log.
Any idea why or how I could work around it?
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Run WebParser only once?

Post by Yincognito »

Nookz wrote: December 1st, 2023, 10:22 pm

Code: Select all

[!WriteKeyValue Variables SkinPosX "#CURRENTCONFIGX#" "#ParentFolder#Extras\SteamInfo.inc"]
I'm getting an 'Illegal Path' error in the log.
Any idea why or how I could work around it?
Good catch. It seems that !WriteKeyValue doesn't support relative paths like ..\ and such, although I don't see why it wouldn't (unless it only supports literal paths, in which case this should be noted in the manual). For example, assuming there is a [ParentFolderOfYourSkinFolder]\Extras\SteamInfo.inc file on the drive:

Code: Select all

[Variables]
ParentFolder=#CURRENTPATH#..\

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,255,0,255

---Meters---

[Result]
Meter=String
AntiAlias=1
Text=Parent Folder: #ParentFolder##CRLF#SteamInfo: #ParentFolder#Extras\SteamInfo.inc
LeftMouseUpAction=[!WriteKeyValue Variables SkinPosX "#CURRENTCONFIGX#" "#ParentFolder#Extras\SteamInfo.inc"]["#ParentFolder#Extras\SteamInfo.inc"]
DynamicVariables=1
You can clearly see how !WriteKeyValue doesn't work and throws that error for the same path that the plain bang works to open the file. Maybe posting a bug report / suggestion on this in the Bugs & Feature Suggestions section of the forum would be a good idea. Worst case scenario, if not possible to be implemented, you'd get a reason why from the developers.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Run WebParser only once?

Post by Yincognito »

Nookz wrote: December 1st, 2023, 10:22 pm

Code: Select all

[!WriteKeyValue Variables SkinPosX "#CURRENTCONFIGX#" "#ParentFolder#Extras\SteamInfo.inc"]
I'm getting an 'Illegal Path' error in the log.
Any idea why or how I could work around it?
Totally forgot to post a workaround to use in the meantime. Here it is:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,255,0,255

---Measures---

[ParentFolder]
Measure=String
String=#CURRENTPATH#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="\\$":"","^(.*)(?:\\.*?){1}$":"\1\"
DynamicVariables=1

---Meters---

[Result]
Meter=String
AntiAlias=1
Text=Parent Folder: [ParentFolder]#CRLF#SteamInfo: [ParentFolder]Extras\SteamInfo.inc
LeftMouseUpAction=[!WriteKeyValue Variables SkinPosX "#CURRENTCONFIGX#" "[ParentFolder]Extras\SteamInfo.inc"]["[ParentFolder]Extras\SteamInfo.inc"]
DynamicVariables=1
The equivalent measure will remove {N} path levels from what you feed it in the String option, via the regex substitution, basically giving the N-th parent folder (using {1} gives the parent folder you're after). It will work for both folder and file paths, but in the case of the latter you'd have to use {2} to get what you want from something like "#CURRENTPATH#SomeFile.ini". The backslash is added automatically at the end, even for the {0} path level in case of files (in effect, turning the file path into a folder one).
Last edited by Yincognito on December 2nd, 2023, 3:04 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: Run WebParser only once?

Post by Nookz »

Once again, fairly simple solution to a fairly simple problem. I like it.
Works perfectly for what I'm using it for too. Thanks!! :D
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Run WebParser only once?

Post by Yincognito »

Nookz wrote: December 2nd, 2023, 3:16 am Once again, fairly simple solution to a fairly simple problem. I like it.
Works perfectly for what I'm using it for too. Thanks!! :D
You're welcome, glad it suits your case! :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: Run WebParser only once?

Post by Nookz »

Since this is related to the same skin I've been asking questions about i'll keep it here, but I can make a new post if needed.
I have a bit of an issue right now using relative positioning:

-I have a bunch of image meters all of the same dimension and they are position in the X axis with:
X=R
-After those meters I also have a bunch of 'text' meters that represent an icon each (using Segoe Fluent Icons). They are all using the same icon and they are position in the X axis with this:
X=(150-[MoveVis:W])R ; (150 is the length of one image and MoveVis is a dummy meter replicating the text meters icon and positioned in between both set of meters)
-Both sets of meters are linked together by a group each. (first image meter is linked to first text meter and so on)
-This work as I expected and align everything like it need it to.

What I'm trying to do:
When I click on one of the icon, it should hide the corresponding MeterGroup and, in theory, make everything line up, but that's not the case.
The icon meters that comes after the one that's been hidden are not repositioned like I'd hoped. The images are tho.

for example, say there's 4 meters for each set and I hide the third of each set.
My understand of this:
If the value is appended with R, the position is relative to the bottom/right edge of the previous meter
was that Image 4 would get pushed back 150 pixel ( basically just aligning itself with the previous visible image ) and the 4th text meter would also be pushed back 150 pixel, aligning itself with the previous visible meter ( essentially just replacing the 3rd one ). But what SEEMS to happen is that the 4th one is only pushed back the equivalent of [MoveVis:W].

also worth nothing that:
-all the subsequent meters after the 'problematic' one would have the proper spacing of "(150-[MoveVis:W])R"..
-I'm aware I could have each icon meter position relatively to their corresponding image meter by placing them one after the other, but the meters arrangement I'm currently using is needed in other part of my skin..

I don't know if that's gonna be useful, but I made a test skin to showcase my issue:
test_.rmskin
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Run WebParser only once?

Post by Yincognito »

Nookz wrote: December 6th, 2023, 8:15 pm Since this is related to the same skin I've been asking questions about i'll keep it here, but I can make a new post if needed.
I have a bit of an issue right now using relative positioning:

-I have a bunch of image meters all of the same dimension and they are position in the X axis with:
X=R
-After those meters I also have a bunch of 'text' meters that represent an icon each (using Segoe Fluent Icons). They are all using the same icon and they are position in the X axis with this:
X=(150-[MoveVis:W])R ; (150 is the length of one image and MoveVis is a dummy meter replicating the text meters icon and positioned in between both set of meters)
-Both sets of meters are linked together by a group each. (first image meter is linked to first text meter and so on)
-This work as I expected and align everything like it need it to.

What I'm trying to do:
When I click on one of the icon, it should hide the corresponding MeterGroup and, in theory, make everything line up, but that's not the case.
The icon meters that comes after the one that's been hidden are not repositioned like I'd hoped. The images are tho.

for example, say there's 4 meters for each set and I hide the third of each set.
My understand of this:

was that Image 4 would get pushed back 150 pixel ( basically just aligning itself with the previous visible image ) and the 4th text meter would also be pushed back 150 pixel, aligning itself with the previous visible meter ( essentially just replacing the 3rd one ). But what SEEMS to happen is that the 4th one is only pushed back the equivalent of [MoveVis:W].

also worth nothing that:
-all the subsequent meters after the 'problematic' one would have the proper spacing of "(150-[MoveVis:W])R"..
-I'm aware I could have each icon meter position relatively to their corresponding image meter by placing them one after the other, but the meters arrangement I'm currently using is needed in other part of my skin..

I don't know if that's gonna be useful, but I made a test skin to showcase my issue:
test_.rmskin
I didn't check the code (yet), but I bet your problem is due to a faulty understanding of how hiding a meter works (don't worry, this is pretty common, especially since folks usually skip the relevant bits from the manual anyway). Hiding a meter simply makes its size 0, that's all, it has no effect on the gaps between meters due to relative positioning and they will stay the same and occupy space even if the neighboring meter is hidden (see the Hidden option notes below):
https://docs.rainmeter.net/manual/meters/general-options/

So, if that's what I suspect it is, you'll have to use formula positioning (e.g. X=(#StartX#+(#ItemW#+#GapW#)*#ItemIndex#) as a standard approach, with the index fluctuating based on visibility), or find a way to make the gap 0 as well (either in the relative positioning e.g. X=(#GapW#*#ItemVisible#)R or other r or R variations, setting the X option properly when hiding the meter, or even making the gaps itself a dummy meter and hiding it as well when hiding the neighboring meter via groups or separately).

There are many ways to approach this, with the list above just from the top of my head, if the issue is the one I suspect it is. If not, then let me know to look at the code and see what's this all about (I'm on my phone right now, so can't test, if anything I'll take a look at it tomorrow).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: Run WebParser only once?

Post by Nookz »

Yincognito wrote: December 6th, 2023, 9:39 pm I didn't check the code (yet), but I bet your problem is due to a faulty understanding of how hiding a meter works (don't worry, this is pretty common, especially since folks usually skip the relevant bits from the manual anyway). Hiding a meter simply makes its size 0, that's all,
Yup. that was exactly it. I didn't understood ( or read the proper manual section about it) that hiding a meter made it's size 0 and thus was it still being used for relative positioning.
I fixed my issue by adding [!SetOption Icon# X "[MoveVis:W]r"] to the icon meters. Thanks again for the quick answer and efficient solution!
Edit: after all that wasn't so simple, but still. I get the point now. ^^
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Run WebParser only once?

Post by Yincognito »

Nookz wrote: December 6th, 2023, 10:58 pm Edit: after all that wasn't so simple, but still. I get the point now. ^^
Yep, the solution you'll choose pretty much depends on how your structure is built in your skin and what adjustment you consider more comfortable in your case - that's why I left the solution a bit open in that regard. Looking at your code now, a relatively simple way of dealing with it would be to place each String meter after the corresponding Image one so you can directly use relative positioning, use right alignment for the text, and get rid of the dummy meter:

Code: Select all

[Rainmeter]
Update=-1
DynamicWindowSize=1
;-----------------------------------STYLEMETERS
[IconStyle]
Text="[\xe7b3]"
StringAlign=RightBottom
FontColor=255,255,255,255
FontFace=Segoe Fluent Icons
InlineSetting=Shadow | 0 | -1 | 3 | 0,0,0,255
MouseActionCursor=0
DynamicVariables=1
UpdateDivider=-1
FontWeight=400
FontSize=12
AntiAlias=1
Y=70
StringAlign=Right
X=-5R

[ImageStyle]
ImageName=#@#test
UpdateDivider=-1
PreserveAspectRatio=1
DynamicVariables=1
AntiAlias=1
X=5r
;-----------------------------------IMAGEICONMETERS
[Image1]
Meter=Image
MeterStyle=ImageStyle
Group=G1

[Vis1]
Meter=String
MeterStyle=IconStyle
LeftMouseUpAction=[!HideMeterGroup G1][!ReDraw]
Group=G1

[Image2]
Meter=Image
MeterStyle=ImageStyle
Group=G2

[Vis2]
Meter=String
MeterStyle=IconStyle
LeftMouseUpAction=[!HideMeterGroup G2][!ReDraw]
Group=G2

[Image3]
Meter=Image
MeterStyle=ImageStyle
Group=G3

[Vis3]
Meter=String
MeterStyle=IconStyle
LeftMouseUpAction=[!HideMeterGroup G3][!ReDraw]
Group=G3

[Image4]
Meter=Image
MeterStyle=ImageStyle
Group=G4

[Vis4]
Meter=String
MeterStyle=IconStyle
LeftMouseUpAction=[!HideMeterGroup G4][!ReDraw]
Group=G4
Now, this will work for this exact layout, but it will not if it's different when it comes to the gap between the groups. In this code, I took advantage of the fact that X=-5R in the String meters was completely canceled by the X=5r in the Image meters, effectifvely making the relative positioning gap between groups 0 ... but it will not work if you set, for example, X=50r in the Image meters, since then you'll have a group gap of 45 pixels which will not be zeroed when hiding the group.

The solutions to this are not complicated, they just need to be thought through so they work in the design you have in mind. This doesn't mean the relative positioning is bad or some other positioning is good, it just means that you'll need to find a way to hide both the meter(s) AND the gap between them (aka making both sizes 0). Basically, hiding just the meter is not enough if the space between meters stays the same, like you already noticed. ;-)

P.S. One more thing - don't be limited to the classic / standard ways of handling this, feel free to think outside the box and "trick the system", so to speak. For example, instead of making X=50r in the Image meters and see that it doesn't work, you could keep the same X=5r but set a Padding=45,0,0,0 to get the other 45 pixels of the 50 as padding that "belongs" to the meter, and, as a consequence, is hidden (zeroed in size) along with it. Result: this will work, you just beat the system, lol. Of course, if you want a SolidColor when you're using a Padding, then your visuals might not be that symmetrical, but that's another matter.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: Run WebParser only once?

Post by Nookz »

Yincognito wrote: December 7th, 2023, 1:38 am Now, this will work for this exact layout, but it will not if it's different when it comes to the gap between the groups. In this code, I took advantage of the fact that X=-5R in the String meters was completely canceled by the X=5r in the Image meters, effectifvely making the relative positioning gap between groups 0 ... but it will not work if you set, for example, X=50r in the Image meters, since then you'll have a group gap of 45 pixels which will not be zeroed when hiding the group.

The solutions to this are not complicated
Yeah.. I think I was overcomplicating things. In the end I ended up using something similar to what you suggested here. Now I'm thinking of adding one or two more feature (prepare for more questions! :D ) and I will finally be done with the skin^^