It is currently April 18th, 2024, 8:38 pm

Can Pause not toggle?

Get help with creating, editing & fixing problems with skins
Alan Smith
Posts: 6
Joined: June 26th, 2017, 12:54 pm

Can Pause not toggle?

Post by Alan Smith »

I have created a button that switches my screen off (by Executing ScreeOff.exe) and Pauses PlayingNow (MediaMonkey). Unfortunately it appears that Pause is a toggle so if no music is playing my button "unpauses" it - clearly the opposite of what I want. I have tried various work arounds but with no success - any advice gratefully received.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can Pause not toggle?

Post by balala »

What bang have you used? Because what you want is not too hard to be achieved:

Code: Select all

[MeasurePlayer]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#Player#
PlayerType=TITLE

[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=ARTIST

[MeterButton]
Meter=BUTTON
ButtonImage=#@#Pause.png
X=0
Y=0
LeftMouseUpAction=[!CommandMeasure "MeasurePlayer" "Pause"]
Note that if in the !CommandMeasure bang of the LeftMouseUpAction option you use Pause, the button will just pause the playback. With Play it'll play and the "toggle" is achieved with PlayPause. So, I suppose you've used PlayPause. If I'm right, just replace it with Pause.
If still not working as it should, please post the code you have so far.
Alan Smith
Posts: 6
Joined: June 26th, 2017, 12:54 pm

Re: Can Pause not toggle?

Post by Alan Smith »

Thank you for your quick response - brilliant stuff. I have already done as you describe but it has not resolved the problem. The only difference in my coding is that my LeftMouseUpAction has to have two functions (pause music + screen off) so the code I am using is: LeftMouseUpAction=[!CommandMeasure mPlayer "Pause"] | !Execute ["#@#\ScreenOff\ScreenOff.exe"], but Pause still toggles. To narrow things down, I have tried the same mouse action command without the ScreenOff command, but still Pause toggles.

My measure coding is:
[mPlayer]
Measure=Plugin
Plugin=NowPlaying
PlayerName=MediaMonkey
PlayerType=TITLE
Alan Smith
Posts: 6
Joined: June 26th, 2017, 12:54 pm

Re: Can Pause not toggle?

Post by Alan Smith »

Thanks for this. The check State option is one of the work arounds I tried but came unstuck because if State is "stopped" (0) or "paused" (2) I don't want to do anything, but I can't work out how to translate this into a suitable CommandMeasure. Any thoughts?
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can Pause not toggle?

Post by balala »

First let's see if the issue is indeed related to the media player. Please try my above code, with another player. If you don't have installed any, probably have at least the Windows Media Player, use it:

Code: Select all

[MeasurePlayer]
Measure=Plugin
Plugin=NowPlaying
PlayerName=WMP
PlayerType=TITLE

[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=ARTIST

[MeterButton]
Meter=BUTTON
ButtonImage=#@#Pause.png
X=0
Y=0
LeftMouseUpAction=[!CommandMeasure "MeasurePlayer" "Pause"]
Does it works well, just pausing the playback?
Alan Smith
Posts: 6
Joined: June 26th, 2017, 12:54 pm

Re: Can Pause not toggle?

Post by Alan Smith »

Not sure what DVO is drinking, but in answer to BALALA, yes your coding worked, thank you. Windows Media Player behaved as expected with pause not toggling. Weirdly though, I linked the coding to my Pause button image which was then shown as 1/3rd only. When I scrolled over the button the right third showed. When I clicked, the centre third showed. All attempts at changing the size with W & H settings had no effect. All of which is making doubt my installation of Rainmeter (4.1)
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can Pause not toggle?

Post by balala »

dvo wrote:wmp is no monkey
It's definitely not. But I said to try another player, to check if the skin is working well with a player known as working well with the needed bang. And WMP is. I can certify this, because I tried, before I posted my reply.
Maybe it worth a try...
dvo wrote:sorry wmp not included in win10 :D can't test ...
:o Are you sure you don't have it? Because as far as I know, it is included even in the Win 10: https://answers.microsoft.com/en-us/windows/wiki/windows_10-start/how-to-locate-and-open-windows-media-player-in/7d0f31a1-2999-4597-9c43-b48b075c5e57
dvo wrote:but vlc 2.15 still does the job :) newer is not supported ;-)
Yeah, but I don't know if Alan Smith has it installed. But he more certainly he has the WMP (see above). That's why I proposed him to check the code with WMP.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can Pause not toggle?

Post by balala »

Alan Smith wrote:Not sure what DVO is drinking, but in answer to BALALA, yes your coding worked, thank you. Windows Media Player behaved as expected with pause not toggling.
In this case, probably the Media Monkey you have installed doesn't support the needed feature. I can't check, because I don't have it installed, but I don't see any other explanation why the code doesn't work with WMP and doesn't with Media Monkey.
Alan Smith wrote:Weirdly though, I linked the coding to my Pause button image which was then shown as 1/3rd only. When I scrolled over the button the right third showed. When I clicked, the centre third showed. All attempts at changing the size with W & H settings had no effect. All of which is making doubt my installation of Rainmeter (4.1)
That's not weird at all. This is how a Button meter is working: it shows normally the left side of its image, the right side when you're hovering the mouse over it and the middle, when clicked. That's a perfectly normal behavior. The image must be created accordingly. See the description of the ButtonImage option of the Button meters. Here also is a very good description of how to create and use the needed image.
Alan Smith
Posts: 6
Joined: June 26th, 2017, 12:54 pm

Re: Can Pause not toggle?

Post by Alan Smith »

Thank you very much Balala on both counts. For info: I tried reverting back to Rainmeter 4.0, but no change there. I will just live with the Pause toggle as an unsubscribed feature!
As for the Button meter - I didn't spot that. I have always used an Image meter - so I have learnt something there and no doubt will be using it very shortly.
Again, many thanks.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can Pause not toggle?

Post by balala »

Alan Smith wrote:Thank you very much Balala on both counts. For info: I tried reverting back to Rainmeter 4.0, but no change there. I will just live with the Pause toggle as an unsubscribed feature!
In such cases reinstalling a previous version of Rainmeter usually doesn't help, it doesn't worth.
Alan Smith wrote:Thanks for this. The check State option is one of the work arounds I tried but came unstuck because if State is "stopped" (0) or "paused" (2) I don't want to do anything, but I can't work out how to translate this into a suitable CommandMeasure. Any thoughts?
Here is a new code to see if it does help you: this one will set up the LeftMouseUpAction of the [MeterButton] meter, accordingly to the state of the player, determined based on the value returned by the NowPlaying plugin:

Code: Select all

[Variables]
PlayerName=ADD HERE THE PROPER PLAYER

[MeasurePlayer]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=TITLE

[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=ARTIST

[MeasureState]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=STATE
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOption MeterButton LeftMouseUpAction """[!CommandMeasure "MeasurePlayer" "PlayPause"]"""][!UpdateMeter "MaterGmail"]
IfFalseAction=[!SetOption MetrButton LeftMouseUpAction ""][!UpdateMeter "MaterGmail"]
I just realized, I'm not sure what player are you using. Maybe you've posted previously, but I'm lazy to read the whole discussion (sorry...). You can find the possible player codes here. Add the needed code to the PlayerName variable, within the [Variables] section.
See that the IfTrueAction / IfFalseAction options are setting the proper LeftMouseUpAction to the [MeterButton] meter, according to the state of the player. The Button will pause the playback if the player is playing and will do nothing, otherwise (so if the player is paused, stopped or closed).
The only question is if your player properly supports the State function. Probably (and I hope) it does, but you have to try it. So, does the above code work well?