It is currently April 24th, 2024, 8:01 am

Help with freezing marquees.

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7151
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with freezing marquees.

Post by Yincognito »

chamlex wrote: February 21st, 2020, 11:13 pm Yeah I get the dreaded spinning circle and when I open Task Manager it lists Rainmeter as not responding. Yeah the x and y puts it in the middle of my desktop where I have an area on my background that this would've fit perfectly. I just typed that in there versus putting it in Rainmeter screen. I assumed either would've worked.
So, after some relax time and a couple of other things I had to finish tonight, here it is, the "classic" version, with no ActionTimer and all. I took the liberty to modify things to better suit the adaptation and make them clearer / more reachable (no need for a Variables.inc in this one), but feel free to change (back) things as desired if you want. If you change them though, use some common sense logic to figure out what else you would need to do to keep things working (e.g. if you need to "split" the two Title+Artist fields into separate sliding "objects" you would have to create 2 Counter measures and change each one to correspond to the skin elements related to each field, as well as moving the mouse actions from the container to each field's meter; if you need to combine them and maybe append them to each other you would have to set one of the field's meters to aggregate the two, replace the Max() formula with the width of the aggregated meter and otherwise not change much, and so on). This works in my case with Winamp, as long as a song has those MP3 tags present (which is why I was under the impression that measures didn't have values earlier), hopefully will work in your case as well:

The skin code

Code: Select all

[Variables]
@IncludeVariables=#@#Variables.inc
Player=Winamp
Color1=255,255,255,255
Color2=153,204,0,255
BoxWidth=233
BoxHeight=80
ContainerWidth=233
ContainerHeight=40
TitleWidth=0
ArtistWidth=0
ScrollingStep=10
SlidingStep=1
CurrentStep=(#SlidingStep#)
SlidingUpdate=24

[Rainmeter]
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1
Update=#SlidingUpdate#

---Playback Measures---

[MeasureArtist]
Measure=NowPlaying
PlayerName=#Player#
PlayerType=Artist
RegExpSubstitute=1
Substitute="^$":"No Artist"
UpdateDivider=(1000/#SlidingUpdate#)

[MeasureTitle]
Measure=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=Title
RegExpSubstitute=1
Substitute="^$":"No Title"
UpdateDivider=(1000/#SlidingUpdate#)

[MeasureAlbum]
Measure=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=Album
RegExpSubstitute=1
Substitute="^$":"No Album"
UpdateDivider=(1000/#SlidingUpdate#)

[MeasureStateButton]
Measure=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=State
RegExpSubstitute=1
Substitute="0":"#@#Play.png","1":"#@#Pause.png","2":"#@#Play.png"
UpdateDivider=(1000/#SlidingUpdate#)

---Animation Measures---

[MeasureCounter]
Group=CounterGroup
Measure=Calc
Formula=((MeasureCounter<0)?(#ContainerWidth#+#TextWidth#):((MeasureCounter>(#ContainerWidth#+#TextWidth#))?(0):(MeasureCounter+#CurrentStep#)))
OnUpdateAction=[!SetOptionGroup SlidingGroup X (#ContainerWidth#-[MeasureCounter])][!UpdateMeterGroup "SlidingGroup"][!RedrawGroup "SlidingGroup"]
IfCondition=(MeasureCounter<0)
IfTrueAction=[!UpdateMeterGroup "SlidingGroup"][!UpdateMeasure "MeasureCounter"]
IfCondition2=(MeasureCounter>(#ContainerWidth#+#TextWidth#))
IfTrueAction2=[!DisableMeasure "MeasureCounter"][!UpdateMeasure "MeasureCounter"][!EnableMeasure "MeasureCounter"][!UpdateMeasure "MeasureCounter"]
IfConditionMode=1
DynamicVariables=1

---Animation Meters---

[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,#BoxWidth#,#BoxHeight# | StrokeWidth 0 | Stroke Color 255,64,32 | Fill Color 32,32,32,128
UpdateDivider=-1

[MeterContainer]
Meter=Shape
Shape=Rectangle 0,0,#ContainerWidth#,#ContainerHeight# | StrokeWidth 0 | Stroke Color 255,64,32 | Fill Color 32,32,32,128
UpdateDivider=-1
MouseOverAction=[!PauseMeasure "MeasureCounter"]
MouseLeaveAction=[!UnpauseMeasure "MeasureCounter"]
MouseScrollUpAction=[!SetVariable CurrentStep (-#ScrollingStep#)][!UnpauseMeasure "MeasureCounter"][!UpdateMeasureGroup "CounterGroup"][!PauseMeasure "MeasureCounter"][!SetVariable CurrentStep (#SlidingStep#)]
MouseScrollDownAction=[!SetVariable CurrentStep (#ScrollingStep#)][!UnpauseMeasure "MeasureCounter"][!UpdateMeasureGroup "CounterGroup"][!PauseMeasure "MeasureCounter"][!SetVariable CurrentStep (#SlidingStep#)]
MiddleMouseUpAction=[!UnpauseMeasure "MeasureCounter"][!UpdateMeasure "MeasureCounter"][!DisableMeasure "MeasureCounter"][!UpdateMeasure "MeasureCounter"][!EnableMeasure "MeasureCounter"][!UpdateMeasure "MeasureCounter"][!PauseMeasure "MeasureCounter"]

[MeterTitle]
Group=SlidingGroup
Meter=String
FontColor=#Color1#
FontFace=Arial
FontSize=14
MeasureName=MeasureTitle
Container=MeterContainer
X=(#ContainerWidth#)
Y=0
Text="%1"
AntiAlias=1
DynamicVariables=1
UpdateDivider=(1000/#SlidingUpdate#)
OnUpdateAction=[!SetVariable TitleWidth [MeterTitle:W]]

[MeterArtist]
Group=SlidingGroup
Meter=String
FontColor=#Color1#
FontFace=Arial
FontSize=14
Container=MeterContainer
MeasureName=MeasureArtist
X=(#ContainerWidth#)
Y=20
Text="%1"
AntiAlias=1
DynamicVariables=1
OnUpdateAction=[!SetVariable ArtistWidth [MeterArtist:W]][!SetVariable TextWidth (Max(#TitleWidth#,#ArtistWidth#))]

---Button Meters---

[MeterPrevious]
Meter=Image
ImageName=#@#Previous.png
X=57
Y=46
W=26
AntiAlias=1
ImageTint=#Color2#
SolidColor=0,0,0,1
LeftMouseUpAction=[!CommandMeasure "MeasureArtist" "Previous"]
UpdateDivider=(1000/#SlidingUpdate#)

[MeterPlayPause]
Meter=Image
ImageName=[MeasureStateButton]
X=103
Y=46
W=26
AntiAlias=1
SolidColor=0,0,0,1
ImageTint=#Color2#
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure "MeasureArtist" "PlayPause"]
UpdateDivider=(1000/#SlidingUpdate#)

[MeterNext]
Meter=Image
ImageName=#@#Next.png
X=149
Y=46
W=26
AntiAlias=1
ImageTint=#Color2#
SolidColor=0,0,0,1
LeftMouseUpAction=[!CommandMeasure "MeasureArtist" "Next"]
UpdateDivider=(1000/#SlidingUpdate#)
A demo showing it works
ezgif.com-video-to-gif.gif
P.S. Pardon the icons I used as substitutes for the .png-s you linked to in your skin, they are just a couple of those I use in my skin suite's tooltips. Also, the fluidity of the GIF had to suffer during the online conversion due to site requirements - in real time the animation is perfectly smooth.

I'll let balala and others to provide a possible ActionTimer version, if they feel like it. As long as that version is properly done and avoids recursion and endless animation (which this version doesn't have to), you should be fine with both. I'll be a lil' busy during the first part of tomorrow, but let us know how it goes with this code anyway. Cheers!
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
chamlex
Posts: 15
Joined: February 16th, 2020, 12:13 am

Re: Help with freezing marquees.

Post by chamlex »

Wow, thanks I'm speechless at the help y'all given me! This is scrolling so far with no issue and gives me a good base for any edits if i want to make to it. Thanks again
chamlex
Posts: 15
Joined: February 16th, 2020, 12:13 am

Re: Help with freezing marquees.

Post by chamlex »

One more thing this is showing in the log, since it's working I'm assuming I can just ignore it.

Syntax error: IfCondition2=(MeasureCounter>(233+#TextWidth#))
User avatar
Yincognito
Rainmeter Sage
Posts: 7151
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with freezing marquees.

Post by Yincognito »

chamlex wrote: February 22nd, 2020, 4:11 am One more thing this is showing in the log, since it's working I'm assuming I can just ignore it.

Syntax error: IfCondition2=(MeasureCounter>(233+#TextWidth#))
Yeah, I noticed from the beginning that this happens in my skin as well (but curiously, not in the ones in my suite, which are based on the same principle). Must be some leftover thing I didn't do quite "to the letter". Most likely, the result of the formula before #TextWidth# had the chance to "initialize" or get a proper value. See if replacing the variable with a Calc measure (the sort of which you had there earlier) solves this little "glitch" (but make a skin backup first).

I put setting the variables with the width values in the OnUpdateAction-s of corresponding measures because, logically, a meter needs to be drawn before getting its dimensions - you can't do the latter before the former.

Anyway, this doesn't seem to hamper the functioning of the skin in any way, so, if you can figure out what's up with it, fine, if not, also fine.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with freezing marquees.

Post by balala »

Yincognito wrote: February 22nd, 2020, 5:23 am Anyway, this doesn't seem to hamper the functioning of the skin in any way, so, if you can figure out what's up with it, fine, if not, also fine.
Without entering too deeply into the code, I'd say that there is a simple way to fix this error: you have to initialize the TextWidth variable into the [Variables] section. Add it there:

Code: Select all

[Variables]
...
TextWidth=0
Sorry if this doesn't fixes the error, I didn't try the provided code, just think this fixes it.
chamlex
Posts: 15
Joined: February 16th, 2020, 12:13 am

Re: Help with freezing marquees.

Post by chamlex »

balala wrote: February 22nd, 2020, 3:59 pm Without entering too deeply into the code, I'd say that there is a simple way to fix this error: you have to initialize the TextWidth variable into the [Variables] section. Add it there:

Code: Select all

[Variables]
...
TextWidth=0
Sorry if this doesn't fixes the error, I didn't try the provided code, just think this fixes it.
That took care of the error. Thanks!
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with freezing marquees.

Post by balala »

chamlex wrote: February 22nd, 2020, 4:13 pm That took care of the error.
Yep, using a variable with no initial value, seems a common mistake. Doesn't prevent the skin to work, just gives an error message in the log, when the skin is refreshed / loaded.
Glad it is fixed as well.
User avatar
Yincognito
Rainmeter Sage
Posts: 7151
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with freezing marquees.

Post by Yincognito »

balala wrote: February 22nd, 2020, 4:41 pm Yep, using a variable with no initial value, seems a common mistake. Doesn't prevent the skin to work, just gives an error message in the log, when the skin is refreshed / loaded.
Glad it is fixed as well.
Ah, yes - thanks a lot, balala! I knew I forgot to do something. The explanation for this is that in the "classic" animation skin I posted earlier, I used only one animated text (i.e. [MeterText]), whose width was TextWidth. When I began converting the OP's skin to use that kind of animation, I had to "split" [MeterText] into a meter for the song title and one for the artist, so TextWidth became the maximum between the widths of the two meters. I used the already existent TextWidth=0 line in the [Variables] section to initialize the width of the first of those meters (i.e. TitleWidth) (by overwriting the existing line), added the second width (i.e. ArtistWidth), but forgot to add back the now modified TextWidth=0 line (which was TitleWidth=0 after editing the file). That's why the error was present only in this skin and not in similar ones (where I didn't have to convert from using a single variable to using three instead).

I'm usually very careful with initializing the variables (even if there is no need to, due to their 0 default value), but now it was just a matter of something I missed in the process of editing and conversion.

P.S. Sorry for the delay, folks - as I told you, it was a busy day today.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with freezing marquees.

Post by balala »

Yincognito wrote: February 22nd, 2020, 7:53 pm Ah, yes - thanks a lot, balala! I knew I forgot to do something. The explanation for this is that in the "classic" animation skin I posted earlier, I used only one animated text (i.e. [MeterText]), whose width was TextWidth. When I began converting the OP's skin to use that kind of animation, I had to "split" [MeterText] into a meter for the song title and one for the artist, so TextWidth became the maximum between the widths of the two meters. I used the already existent TextWidth=0 line in the [Variables] section to initialize the width of the first of those meters (i.e. TitleWidth) (by overwriting the existing line), added the second width (i.e. ArtistWidth), but forgot to add back the now modified TextWidth=0 line (which was TitleWidth=0 after editing the file). That's why the error was present only in this skin and not in similar ones (where I didn't have to convert from using a single variable to using three instead).
Yep, it happens many times. Don't worry, I'm glad if you got it working.
Yincognito wrote: February 22nd, 2020, 7:53 pm I'm usually very careful with initializing the variables (even if there is no need to, due to their 0 default value), but now it was just a matter of something I missed in the process of editing and conversion.
Sorry, this is wrong. In Rainmeter, unlike in a programming language (what Rainmeter isn't), if a variable isn't specifically initialized into the [Variables] section, it's value isn't 0. It simply doesn't exist and if it is used somewhere in the code, even if it is set through a !SetVariable bang, it still gives an error message in the log when the skin is refreshed / loaded.
User avatar
Yincognito
Rainmeter Sage
Posts: 7151
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with freezing marquees.

Post by Yincognito »

balala wrote: February 23rd, 2020, 3:15 pm Yep, it happens many times. Don't worry, I'm glad if you got it working.

Sorry, this is wrong. In Rainmeter, unlike in a programming language (what Rainmeter isn't), if a variable isn't specifically initialized into the [Variables] section, it's value isn't 0. It simply doesn't exist and if it is used somewhere in the code, even if it is set through a !SetVariable bang, it still gives an error message in the log when the skin is refreshed / loaded.
You're right that the variable doesn't exist and that its value isn't 0. I'll rephrase it then: what I meant was that when the unitialized / nonexistent variable or its associated measures or variables (obtained by using the said variable) are used in a measure or action, the result is 0. In practice, this means that even though the variable itself is not initialized and has no value, the result of an "operation" with that variable exists and is 0. Proof:

Code: Select all

[Variables]
N=2
X=7

[Rainmeter]
DynamicWindowSize=1
AccurateText=1

---Measures---

[MeasureNum]
Measure=Calc
Formula=(#N#)

[MeasureM]
Measure=Calc
Formula=#M#

[MeasureNPlusM]
Measure=Calc
Formula=(#N#+#M#)

---Meters---

[MeterResults]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
MeasureName=MeasureNPlusM
Text="NPlusM = %1"
UpdateDivider=-1
OnUpdateAction=[!SetVariable NPlusM (#N#+#M#)][!SetVariable XPlusNPlusM (#X#+#NPlusM#)]
LeftMouseUpAction=[!Move "#XPlusNPlusM#" "384"]
RightMouseUpAction=[!UpdateMeter #CURRENTSECTION#]
DynamicVariables=1
M is the unitialized variable.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth