It is currently March 29th, 2024, 12:42 pm

Measure Loop issues

Get help with creating, editing & fixing problems with skins
1Try
Posts: 3
Joined: October 9th, 2022, 6:45 am

Measure Loop issues

Post by 1Try »

!Final Update: It now Works as intended with the help of this post Re: WebParser and SetOption Post by jsmorley » November 25th, 2013, 3:29 pm (https://forum.rainmeter.net/viewtopic.php?t=17080) Thank you. :)

I just added [!CommandMeasure raw "Update"] to the FinishAction in [wall]

FinishAction=[!UpdateMeasure "raw"][!CommandMeasure raw "Update"]



!Update:

So far so good. Now my only problem is that the download continue to only works for the first file.
The indexloop variable is passed into [raw] so it downloads the file in the txt for the first loop value, but it does not use the next file name.
[raw] only works for the first file on load after a manual refresh , but it should move to 0.txt, 1.txt, 2.txt etc.

the current code is:

Code: Select all


[indexloop] -> works fine
Measure=Loop
StartValue=-1
EndValue=[maxnumber]
Increment=1
LoopCount=1
UpdateDivider=2
DynamicVariables=1
OnChangeAction=[!UpdateMeasure "wall"][!CommandMeasure wall "Run"]
IfCondition=indexloop > [maxnumber] - 1
IfTrueAction=[!Refresh "#CURRENTCONFIG#"]

[wall] -> works fine
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=python walls.py -f test.txt -k [&indexloop]
DynamicVariables=1
FinishAction=[!UpdateMeasure "raw"]


[raw] -> passes only the first value as -1.txt (file exists and contains a valid url) so the image is downloaded and displayed but it doesn't move to the next [indexloop] value

Measure=WebParser
Url=file:///#CURRENTPATH#[&indexloop].txt
RegExp=(?siU)(.*\n)
StringIndex=1
DynamicVariables=1
FinishAction=[!UpdateMeasure "urlImage"]

[urlImage]
Measure=WebParser
Url=[raw]
StringIndex=1
Download=1
DownloadFile="current.jpg"
DynamicVariables=1
FinishAction=[!ShowMeter DisplayImage][!UpdateMeter DisplayImage][!Redraw][!UpdateMeter MeterDisplay2][!UpdateMeter MeterDisplay3]






Original post:

Hello and thank you for your help & time.

Currently I have some issues with a loop.

1.Although the loop does restart (LoopCount=0), it doesn't start over at [urljson] , at least there are no sign for a new fetch in the debugger.
2.The code works "fine" from [urlJson] and up to [wall]; but the [indexloop] is not passed into [raw].
[raw] only works for the first file after a manual refresh, it should move from 0.txt, 1.txt, 2.txt etc.

Notes:
Meterdisplay 2 & 3 are just for "debugging" purposes, and the UpdateDivider=1 inside the loop is just to see it working, it will be >300

Thank you again for your help.

Here's the code:

Code: Select all


[urlJson]
Measure=WebParser
Url =#someurl#
DynamicVariables=1
Debug=2
FinishAction=[!CommandMeasure max "Run"]

[max]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=python max.py -f WebParserDump.txt
FinishAction=[!UpdateMeasure maxnumber]
DynamicVariables=1

[maxnumber]
Measure=WebParser
Url=file://#CURRENTPATH#max.txt
Regexp=(?siU)^([\s\S]+)$
StringIndex=1
FinishAction=[!UpdateMeasure indexloop]
DynamicVariables=1

[indexloop]
Measure=Loop
StartValue=-1
;-1 so it works with index 0
EndValue=([maxnumber]-1)
;-1 to avoid errors as non inclusive
Increment=1
LoopCount=0
UpdateDivider=1
DynamicVariables=1
OnChangeAction=[!UpdateMeasure "wall"][!CommandMeasure wall "Run"]
FinishAction=[!UpdateMeasure "urlJson"][!CommandMeasure urlJson "Run"]

[wall]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=python walls.py -f WebParserDump.txt -k [&indexloop]
DynamicVariables=1
OnUpdateAction=[!UpdateMeasure "raw"]

[raw]
Measure=WebParser
Url=file:///#CURRENTPATH#[&indexloop].txt
RegExp=(?siU)(.*\n)
StringIndex=1
DynamicVariables=1
FinishAction=[!UpdateMeasure "urlImage"][!UpdateMeasure "raw"]

[urlImage]
Measure=WebParser
Url=[raw]
StringIndex=1
Download=1
DownloadFile="current.jpg"
DynamicVariables=1
FinishAction=[!ShowMeter DisplayImage][!UpdateMeter DisplayImage][!Redraw][!UpdateMeter MeterDisplay2][!UpdateMeter MeterDisplay3]

[DisplayImage]
Meter=Image
MeasureName=urlImage
W=#Width#
H=#Height#
PreserveAspectRatio=0
Padding=#Padding#,#Padding#,#Padding#,#Padding#
SolidColor=0,0,0,128
Hidden=1
AntiAlias=1
DynamicVariables=1


[MeterDisplay2]
Meter=String
MeasureName=indexloop
Hidden=0
DynamicVariables=1
FontSize=50


[MeterDisplay3]
Meter=String
MeasureName=raw
Hidden=0
DynamicVariables=1
FontSize=50