It is currently May 17th, 2024, 9:23 am

Issue with music progress bar.

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16225
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Issue with music progress bar.

Post by balala »

RoseRain wrote: June 27th, 2023, 6:13 am The changes I did, I posted Here unless I did it wrong, it was my first time posting one.
That's far away from being a complete code. There are only 9 measure, no meters at all. To make a draggable bar, you need a Bar meter, at least (additionally some String meters would be also expected to be added most probably). Sorry, but no, that's not a complete code.
Note that you can't even activate a skin having only measures, but no meters.
RoseRain wrote: June 27th, 2023, 6:13 am I have been trying to make a draggable progress bar using the mouse plugin all day, and I just can't do it. I have looked at examples from other skins, and I just can't make it work. I managed to make it scrollable and clickable. But I can't seem to add the dragging to it. Just isn't working. I gave up and settled for the clickable/scrollable one for now. lol I am just not knowlegable enough. I will give it another attempt sometime this week and if I still can't get it to work, Ill post the code.
Once again (and yes, I know I'm repeating myself): for help on how to make it draggable, post the whole code, not just some parts of it. Right click the activated skin and click Edit skin. The code of your skin opens in your default text editor. Copy the whole code and paste it into your reply, using the </> button.
User avatar
RoseRain
Posts: 42
Joined: June 30th, 2022, 1:39 pm

Re: Issue with music progress bar.

Post by RoseRain »

balala wrote: June 27th, 2023, 7:57 am That's far away from being a complete code. There are only 9 measure, no meters at all. To make a draggable bar, you need a Bar meter, at least (additionally some String meters would be also expected to be added most probably). Sorry, but no, that's not a complete code.
Note that you can't even activate a skin having only measures, but no meters.
That code wasn't for the draggable bar. That is an old post now. I was posting that code earlier, when we were trying to fix the issue with the progress not going over 3:34 min when clicked, which we have now solved. It was for the previous issue....

Currently...
I have made a simple progress bar to test on that is clickable and scrollable. (Ill put the code) I have removed all the attempts I made at trying to make it drag and removed the mouse measures, to try and start again. I have tried putting in codes to make it drag, based on other skins I have downloaded and the mouse plugin examples, but I just cant do it. Here is the code without all the dragging codes... Just click and scroll. Where and how would I put the dragging codes in there? Any help would be really appreciated!

PS: Would be also nice to add another shape in there to drag, like a line that you click and drag. I tried, but I can't get it to work.

Code: Select all

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

[Variables]
Player=Spotify

;-------------------------------

[MeasurePlayer]
Measure=Plugin
Plugin=WebNowPlaying
PlayerName=Spotify
PlayerType=Progress

[MeasurePosition]
Measure=Plugin
Plugin=WebNowPlaying
PlayerName=[MeasureArtist]
PlayerType=Position

[MeasureDuration]
Measure=Plugin
Plugin=WebNowPlaying
PlayerName=[MeasureArtist]
PlayerType=Duration

[MeasureProgress]
Measure=Plugin
Plugin=WebNowPlaying.dll
PlayerName=#Player#
PlayerType=PROGRESS

;------------------------------

[ProgBar]
Meter=Shape
X=35
Y=0
Shape=Rectangle 0,0,150,20 | Fill Color 100,100,100 | StrokeWidth 0

Shape2=Rectangle 0,0,([MeasureProgress]*1.5),20 | Fill Color 255,0,0 | StrokeWidth 0

LeftMouseUpAction=[!CommandMeasure "MeasureProgress" "SetPosition $MouseX:%$"]
MouseScrollUpAction=[!CommandMeasure "MeasureProgress" "SetPosition +5"][!UpdateMeasure MeasureProgress][!UpdateMeter ProgBar][!Redraw]
MouseScrollDownAction=[!CommandMeasure "MeasureProgress" "SetPosition -5"][!UpdateMeasure MeasureProgress][!UpdateMeter ProgBar][!Redraw]
DynamicVariables=1

;------------------------------

[timer]
Meter=String
MeasureName=MeasurePosition
StringAlign=right
X=30
Y=0
FontColor=255,255,255
FontFace=Calibri
AntiAlias=1
Text=%1
DynamicVariables=1

[timer2]
Meter=String
MeasureName=MeasureDuration
StringAlign=left
X=160r
Y=0
FontColor=255,255,255
FontFace=Calibri
AntiAlias=1
Text=%1
DynamicVariables=1
User avatar
Yincognito
Rainmeter Sage
Posts: 7258
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Issue with music progress bar.

Post by Yincognito »

RoseRain wrote: June 26th, 2023, 11:53 pm I am in the process of trying to learn how to make a draggable one. Really struggling haha, but Ill take a look at the link and see what I make out of it. It's pretty fun learning how. Thanks so much for that.

And I was glad that I was able to bring the issue to attention.
I'm not going to post a full code in this case, because in this way you can't learn for yourself, but what I suggest is START SIMPLE. Forget about doing all at once and start from scratch: a simple skin, with just:
- the typical [Rainmeter] section (Update, AccurateText, DynamicWindowSize)
- a W variable set to, say, 500, that will hold a rectangle's width value
- a rectangle Shape meter having LeftMouseDownAction set to [!CommandMeasure MeasureMouse "Start"], dynamic variables and #W# as the rectangle's width
- the MeasureMouse from the example, where you set the W variable to $MouseX$, update the meter and redraw the skin in the LeftMouseDragAction
Save, refresh and drag with the left mouse button over the rectangle to see the magic happen.

That's all there is to it, it's just a number, which you can then use to set a variable and control, say, the width of that rectangle in the Shape meter. Once you've done that, using it to control any other stuff is pretty trivial, really. Of course, this assumes you did install the Mouse plugin by NighthawkSLO beforehand.
Last edited by Yincognito on June 27th, 2023, 5:53 pm, edited 3 times in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16225
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Issue with music progress bar.

Post by balala »

RoseRain wrote: June 27th, 2023, 8:40 am That code wasn't for the draggable bar.
Right, finally this is a full code (or not!), however there are some inadvertences. For instance in the WebNowPlaying plugine measures. Usually these measures (all of them) should have to have a parent - child structure, which means that one of those measures should be the parent measure (the one having PlayerName=Spotify or PlayerName=#Player# option, which specifies the player used by the measures) and all other measures should have to be child measures. All of these child measures should refere to the parent measure by a (for instance) PlayerName=[MeasureArtist] option (so should refere to another measure). Your code has two measures set as parent ([MeasurePlayer] and [MeasureProgress]) and two other not-working measures ([MeasurePosition] and [MeasureDuration]), which normaly should have to be the child measures. I'm saying they are not working, because they are related to a not-existent measure (by their PlayerName=[MeasureArtist] option - a [MeasureArtist] measure doesn't exist). This leads me thinking the posted code is once again not the whole code, or if it is, it doesn't work. Not just its dragging feature doesn't work, but at least some of the measures are not returning anything.
However I'm gonna show you how to add a dragging feature. Do the followings:
  • Do you have installed the Mouse plugin? Hope you have it. If you don1t have, please let us know, for help on how to install it (if you don't know).
  • If the plugin is installed, add the following two measures to your code:

    Code: Select all

    [MeasureMouse]
    Measure=Plugin
    Plugin=Mouse
    ;RelativeToSkin=1
    RequireDragging=1
    DynamicVariables=1
    LeftMouseDragAction=[!SetVariable CurPosition "(100*($MouseX$-[ProgBar:X])/[ProgBar:W])"][!UpdateMeasure "MeasurePercent"]
    
    [MeasurePercent]
    Measure=Calc
    Formula=#CurPosition#
    DynamicVariables=1
    OnChangeAction=[!CommandMeasure "MeasurePlayer" "SetPosition #CurPosition#"][!UpdateMeter "ProgBar"][!UpdateMeter "timer"][!Redraw]
    Disabled=1
    As you can see, the [MeasureMouse] measure is a Mouse plugin measure, having a LeftMouseDragAction option, which is executed whenever are you dragging the [ProgBar] meter (I tell you below why exactly this one). [MeasurePercent] on the other hand gets the value of the CurPosition variable returned through the LeftMouseDragAction option of the above measure and sets the playing position of the player to this value.
  • Finally add the following two options to the [ProgBar] meter:

    Code: Select all

    [ProgBar]
    ...
    MouseOverAction=[!EnableMeasure "MeasurePercent"][!CommandMeasure "MeasureMouse" "Start"]
    MouseLeaveAction=[!DisableMeasure "MeasurePercent"][!CommandMeasure "MeasureMouse" "Stop"]
    ...
This a simple solution, which has to be improved. It's far away from being perfect, but it lets you make an idea on how the Mouse plugin can be used to can drag the progress bar.
Try out this solution if you are interested and feel free coming back if any question arise (and I think some will arise).
User avatar
keifufu
Posts: 37
Joined: March 10th, 2023, 2:23 pm

Re: Issue with music progress bar.

Post by keifufu »

balala wrote: June 27th, 2023, 4:19 pm For instance in the WebNowPlaying plugine measures.
Note that PlayerName does nothing for WebNowPlaying measures and is just left over from slapping WebNowPlaying on NowPlaying measures, so the structure doesn't matter at all :3
User avatar
Yincognito
Rainmeter Sage
Posts: 7258
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Issue with music progress bar.

Post by Yincognito »

keifufu wrote: June 27th, 2023, 9:43 pm Note that PlayerName does nothing for WebNowPlaying measures and is just left over from slapping WebNowPlaying on NowPlaying measures, so the structure doesn't matter at all :3
Also, if I'm not mistaken, neither the Player option does anything functionally, apart from providing the current player, as seen by the plugin. Correct?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
keifufu
Posts: 37
Joined: March 10th, 2023, 2:23 pm

Re: Issue with music progress bar.

Post by keifufu »

Yincognito wrote: June 27th, 2023, 9:53 pm Also, if I'm not mistaken, neither the Player option does anything functionally, apart from providing the current player, as seen by the plugin. Correct?
Not sure what you mean exactly.
PlayerType=Player does indeed return the current players name, not sure what it should or could be doing functionally?
User avatar
Yincognito
Rainmeter Sage
Posts: 7258
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Issue with music progress bar.

Post by Yincognito »

keifufu wrote: June 27th, 2023, 9:56 pm Not sure what you mean exactly.
PlayerType=Player does indeed return the current players name, not sure what it should or could be doing functionally?
I meant that there isn't even a PlayerName=... option in WebNowPlaying, according to the docs, while PlayerType=Player simply returns a string representing the player, without setting the plugin to work with a certain player like NowPlaying does. I know that you also said that PlayerName=... is a leftover from NowPlaying, my point was to clarify that such an option doesn't exist at all in WebNowPlaying (the closest to it being PlayerType=Player, which only gets a feedback string, so to speak).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
RoseRain
Posts: 42
Joined: June 30th, 2022, 1:39 pm

Re: Issue with music progress bar.

Post by RoseRain »

balala wrote: June 27th, 2023, 4:19 pm
This a simple solution, which has to be improved. It's far away from being perfect, but it lets you make an idea on how the Mouse plugin can be used to can drag the progress bar.
Try out this solution if you are interested and feel free coming back if any question arise (and I think some will arise).
What you did does make it drag, a little slow, but it works. I kind of see where I may have went wrong when I look at the code and compare it to when I had been trying to do before. I hope it placed it all correctly...

Code: Select all

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

[Variables]
Player=Spotify

;-------------------------------

[MeasurePlayer]
Measure=Plugin
Plugin=WebNowPlaying
PlayerName=Spotify
PlayerType=Progress

[MeasurePosition]
Measure=Plugin
Plugin=WebNowPlaying
PlayerName=#Player#
PlayerType=Position

[MeasureDuration]
Measure=Plugin
Plugin=WebNowPlaying
PlayerName=#Player#
PlayerType=Duration

[MeasureProgress]
Measure=Plugin
Plugin=WebNowPlaying.dll
PlayerName=#Player#
PlayerType=PROGRESS

[MeasureMouse]
Measure=Plugin
Plugin=Mouse
;RelativeToSkin=1
RequireDragging=1
DynamicVariables=1
LeftMouseDragAction=[!SetVariable CurPosition "(100*($MouseX$-[ProgBar:X])/[ProgBar:W])"][!UpdateMeasure "MeasurePercent"]

[MeasurePercent]
Measure=Calc
Formula=#CurPosition#
DynamicVariables=1
OnChangeAction=[!CommandMeasure "MeasurePlayer" "SetPosition #CurPosition#"][!UpdateMeter "ProgBar"][!UpdateMeter "timer"][!Redraw]
Disabled=1


;------------------------------

[ProgBar]
Meter=Shape
X=35
Y=0
Shape=Rectangle 0,0,150,20 | Fill Color 100,100,100 | StrokeWidth 0

Shape2=Rectangle 0,0,([MeasureProgress]*1.5),20 | Fill Color 255,0,0 | StrokeWidth 0

LeftMouseUpAction=[!CommandMeasure "MeasureProgress" "SetPosition $MouseX:%$"]
MouseScrollUpAction=[!CommandMeasure "MeasureProgress" "SetPosition +5"][!UpdateMeasure MeasureProgress][!UpdateMeter ProgBar][!Redraw]
MouseScrollDownAction=[!CommandMeasure "MeasureProgress" "SetPosition -5"][!UpdateMeasure MeasureProgress][!UpdateMeter ProgBar][!Redraw]
MouseOverAction=[!EnableMeasure "MeasurePercent"][!CommandMeasure "MeasureMouse" "Start"]
MouseLeaveAction=[!DisableMeasure "MeasurePercent"][!CommandMeasure "MeasureMouse" "Stop"]
DynamicVariables=1

;------------------------------

[timer]
Meter=String
MeasureName=MeasurePosition
StringAlign=right
X=30
Y=0
FontColor=255,255,255
FontFace=Calibri
AntiAlias=1
Text=%1
DynamicVariables=1

[timer2]
Meter=String
MeasureName=MeasureDuration
StringAlign=left
X=160r
Y=0
FontColor=255,255,255
FontFace=Calibri
AntiAlias=1
Text=%1
DynamicVariables=1
I do need help with one more thing, if it's okay to ask...
I have been trying to add an extra shape, like a bar that I can click and drag, but also have it move along with the progress as the song plays. But I can't do it. I looked at the example skin posted earlier, and tried to use it as a guide, copying codes, editing them accordingly etc. I tried to make seperate meters for each shape and try it like that and editing the MeasurePercent and MeasureMouse, but I can't get it to work. I realise I might be asking too much! Maybe its not possible lol

Thank you everyone for all your help!!!
Last edited by RoseRain on June 28th, 2023, 1:48 am, edited 1 time in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Issue with music progress bar.

Post by eclectic-tech »

To add a small indicator that shows the current progress and moves with the level, simply add a third shape to the [Progbar] section:

Code: Select all

[ProgBar]
Meter=Shape
X=35
Y=0
Shape=Rectangle 0,0,150,20 | Fill Color 100,100,100 | StrokeWidth 0

Shape2=Rectangle 0,0,([MeasureProgress]*1.5),20 | Fill Color 255,0,0 | StrokeWidth 0
Shape3=Rectangle (([MeasureProgress]*1.5)-2),0,4,20 | Fill Color 0,255,0 | StrokeWidth 0
barindicate.png
You do not have the required permissions to view the files attached to this post.