Aryx wrote: ↑January 10th, 2024, 12:33 pm
Whoa! It happened! Thank you for guiding - rather doing everything!
Also, cleaning up the code - much appreciated!
Still got few questions though....:
1. What does this do?
Substitute="^(.*)$":'[!CommandMeasure Player "SetPosition \1"]'
2. (Even though I read this somewhere...) [*Track*] means the variable Track, right?
3. What does this do (returns!)?
BangR=[#Bang1][&Progress] (I read:
I restore it by "executing" the string value of the Progress measure in the OnRefreshAction, but still, can't understand it.)
4. Order of the measures is important? I don't understand.. Alphabetical order or something like that?
5. For Shuffle - On, can I use something like this:
Code: Select all
IfCondition=1
IfTrueAction=[!SetVariable Prev "Shuffle On"] [!SetVariable Next "Shuffle On"]
6. For Repeat - On, can I use this:
Code: Select all
IfCondition=1
IfTrueAction=[!SetVariable Prev "Repeat On - [*Track*]"] [!SetVariable Next "Repeat On - [*Track*]"]
I took your suggestions, and changed fading in/out - it does the magic.
I hope you don't mind me being greedy... I don't understand some bits and want to clear it up..
Asking questions to understand something is perfectly normal, I don't mind it at all. Generally, I only have a problem if folks expect me to repeat things that are already described the same way in the manual because they can't be bothered to read it themselves, not about clarifying things for which the existing info is insufficient.
1. Because of the preceding
RegExpSubstitute=1 option, this
Substitute option uses regular expressions (basically, patterns made of literal characters and various symbols used to find and / or replace parts of a string) to transform the string value of that measure into the bang between the
' after the
: sign. In regular expressions,
^ means the start of the string,
$ means the end of the string,
. means every character,
* means taken any number of times,
( and
) are capturing a part of the string, and
\N where N is a number is referencing the N-th capture in the replacement string. So, in effect, I capture the entire string value of the measure (i.e.
^(.*)$) and replace it (i.e.
:) with the bang between apostrophes (i.e.
[!CommandMeasure Player "SetPosition \1"]) where
\1 will be what was captured in the 1st and only capture. In other words, if the string value of that measure is "
27.876" corresponding to the position at 27.876 % of the track, then after the replacement it will become
[!CommandMeasure Player "SetPosition 27.876"]. In case you wonder, apostrophes are used in the 2nd part of the Substitute because there are already quotes in the replacement string (which would confuse Rainmeter if we were to enclose the replacement with quotes too).
3. Because of the above, this will make the value of the
BangR variable to be the string concatenation of
Bang1 and the result from the 1. point. So, it will simply append the bang at 1. (which is setting the position in the track to the last value of the
Progress measure) to the contents of the
Bang1 variable and return it in the
BangR variable. That
BangR variable is executed in the
OnRefreshAction. Without setting the position like that after
Bang1 at refresh time, the song that is playing will be re-played from the start because of all that jumping between tracks in the command bangs. This is an imperfect way to alleviate that positional reset, so to speak.
2.
[Track] is not a classic variable, it's the value of a measure used as a variable (aka a "section variable" in Rainmeter's terminology). You probably read what you mentioned when checking the link about
escaping variables. What escaping does is to temporarily prevent Rainmeter from replacing a variable or measure reference with the actual value of that variable or measure. For example, if the value of the [Track] measure is at one point "SomeTitle - SomeArtist - SomeAlbum" and you do
[!SetVariable Prev "[Track]"], then Prev will be
SomeTitle - SomeArtist - SomeAlbum. However, since I only store those bangs literally in Bang1 and may use it for any other value of the Track measure, I don't want the [Track] to be replaced with some momentary value of it, I want it to stay as the literal
[Track] for the purpose of Bang1. Escaping does that: while
[Track] is parsed as the red text earlier,
[*Track*] is temporarily parsed as the green text earlier (and it will be replaced with its actual value at a later point in the execution).
4. My bad, I had this written there, but got lost after rephrasing things. I meant the order in the code. You can't properly base the result of a measure on another measure that isn't updated yet. For example, this:
Code: Select all
[MeasureOne]
Measure=Calc
Formula=5
[MeasureTwo]
Measure=Calc
Formula=MeasureOne
will correctly result in MeasureTwo being 5, but this:
Code: Select all
[MeasureTwo]
Measure=Calc
Formula=MeasureOne
[MeasureOne]
Measure=Calc
Formula=5
will result in MeasureTwo being initially 0 (since MeasureOne didn't get a value yet in the code), and afterwards being one update behind MeasureOne (e.g. if the value of MeasureOne changes, this will only be reflected in MeasureTwo after one skin update).
5. and 6. I have no idea why you'd want to use those (since you already have the values of shuffle and repeat displayed in meters), where you'd want to use them, or what exactly you'd want to accomplish with them (I suspect they're incomplete in that regard since you don't have an IfFalseAction or an IfConditionMode=1) but if you want to use those IfConditions in the [Shuffle] and [Repeat] measures (IfConditions can only be used in measures, not meters or anything else) and have them produce results on the said variables, then they should be (no need to escape
[Track] if you're not storing the bangs in a variable):
Code: Select all
IfCondition=(Repeat=1)
IfTrueAction=[!SetVariable Prev "Repeat On - [Track]"] [!SetVariable Next "Repeat On - [Track]"]
IfCondition2=(Shuffle=1)
IfTrueAction2=[!SetVariable Prev "Shuffle On"] [!SetVariable Next "Shuffle On"]
and be attached to a measure at the end of the measure list, say, [Track] (because of the 4. point, i.e. to make sure the values are not overwritten by another measure afterwards). By the way, referencing other changing measures or variables in the ...Action options requires having
DynamicVariables=1 on the section where you attach them. Incidentally, [Track] already has that. And yes, the above will only react when toggling shuffle and repeat between on and off, see the
documentation on the IfTrueAction / IfFalseAction / IfConditionMode to understand why.