It is currently March 28th, 2024, 3:02 pm

RAINMETER player (play) button

Get help with installing and using Rainmeter.
Post Reply
galaxyqt
Posts: 2
Joined: September 15th, 2018, 10:03 am

RAINMETER player (play) button

Post by galaxyqt »

Hello everyone. Is there any way that i can click on rainmeter player play button and it starts my AIMP and play the music? i tried alot of different commands and it wont work :/
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: RAINMETER player (play) button

Post by CyberTheWorm »

Code: Select all

RightMouseUpAction=!CommandMeasure "MeasurePlayer" "OpenPlayer"
ToolTipText=Right Mouse Click to Open Player
Use this for my play button, have to put the path the the player in the skin
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: RAINMETER player (play) button

Post by balala »

CyberTheWorm wrote:

Code: Select all

RightMouseUpAction=!CommandMeasure "MeasurePlayer" "OpenPlayer"
ToolTipText=Right Mouse Click to Open Player
Use this for my play button, have to put the path the the player in the skin
I'm not sure this is enough. galaxyqt asked if
galaxyqt wrote:Is there any way that i can click on rainmeter player play button and it starts my AIMP and play the music?
Opening the app probably doesn't starts it playing.
I'm not using AIMP, so I'm not sure this will entirely work, but maybe it worth a try.
You need to check two things: if the player is open and if it is, if it's playing, is paused or stopped. For this you need two NowPlaying measures:

Code: Select all

[MeasurePlayer]
Measure=NowPlaying
PlayerName=AIMP
PlayerType=STATUS

[MeasureState]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=STATE
Then you need a Calc measure, to set the appropriate LeftMouseUpAction to the meter of the Play / Pause button:

Code: Select all

[MeasurePlay]
Measure=Calc
Formula=(( MeasurePlayer = 0 ) ? -1 : MeasureState )
IfCondition=(#CURRENTSECTION#<0)
IfTrueAction=[!SetOption MeterPlay LeftMouseUpAction """[!CommandMeasure "MeasurePlayer" "OpenPlayer"][!Delay "2000"][!CommandMeasure "MeasurePlayer" "Play"]"""][!UpdateMeter "MeterPlay"]
IfFalseAction=[!SetOption MeterPlay LeftMouseUpAction """[!CommandMeasure "MeasurePlayer" "PlayPause"]"""][!UpdateMeter "MeterPlay"]
See that this measure sets a LeftMouseUpAction to the [MeterPlay] meter, depending on the status / state of the player app. If it is closed, the !CommandMeasure bang of the IfTrueAction option opens it and after a delay of 2 seconds, the playing is triggered. The two seconds delay is needed to let the player to completely load and the play would be started just after this. If it's not enough, you can increase the delay.
Otherwise the Play button will be set to start playing if the player is stopped or paused and pause it if it's playing.
Obviously you also need the Play button. I created an extremely simply such button, which is in fact a String meter:

Code: Select all

[MeterPlay]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Play
Adding all these together, here is a complete code:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasurePlayer]
Measure=NowPlaying
PlayerName=AIMP
PlayerType=STATUS

[MeasureState]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=STATE

[MeasurePlay]
Measure=Calc
Formula=(( MeasurePlayer = 0 ) ? -1 : MeasureState )
IfCondition=(#CURRENTSECTION#<0)
IfTrueAction=[!SetOption MeterPlay LeftMouseUpAction """[!CommandMeasure "MeasurePlayer" "OpenPlayer"][!Delay "2000"][!CommandMeasure "MeasurePlayer" "Play"]"""][!UpdateMeter "MeterPlay"]
IfFalseAction=[!SetOption MeterPlay LeftMouseUpAction """[!CommandMeasure "MeasurePlayer" "PlayPause"]"""][!UpdateMeter "MeterPlay"]

[MeterPlay]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Play
What I don't know is what happens when you close AIMP. When opens it keeps the last playlist? Probably yes, but I'm not sure. If it is, then start playing is ok, otherwise...
Please galaxyqt, let me know if this is closer to your needs.
galaxyqt
Posts: 2
Joined: September 15th, 2018, 10:03 am

Re: RAINMETER player (play) button

Post by galaxyqt »

i should paste it no matter where in text folder?
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: RAINMETER player (play) button

Post by balala »

galaxyqt wrote:i should paste it no matter where in text folder?
The last code I posted is a complete code of an extremely simple Rainmeter skin. Probably you already have a skin. If you do, make a backup of it (just in case) then paste the above code in the .ini file of your skin (replacing the existing code), save it and refresh the appropriate skin. Give it a try, to see if it matches your needs.
Does it?
Post Reply