It is currently May 4th, 2024, 11:14 am

[Help] IfAction replace text string

Get help with creating, editing & fixing problems with skins
iConic
Posts: 11
Joined: May 10th, 2011, 6:01 pm

[Help] IfAction replace text string

Post by iConic »

is it possible to change the text string in a specific meter depending on the value of a measure

in my code I have it set up so it calls a meter depending on the value, but it raises other issues
it'd clear up a lot of its possible to replace the "Text=Play" with "Text=Pause" depending on the
PlayState value, does anyone know if that's possible and if so how i'd go about coding that?

Code: Select all

; ================================================
;  MEASURES
; ================================================

[mPlayPause]
Measure=Plugin
Plugin=NowPlaying.dll
MediaPlayer=[mPlayer]
MediaType=STATE
Update=500
IfAboveValue=1
IfAboveAction=!Execute [!RainmeterHideMeter Pause] [!RainmeterShowMeter Play]
IfBelowValue=1
IfBelowAction=!Execute [!RainmeterHideMeter Pause] [!RainmeterShowMeter Play]
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterHideMeter Play] [!RainmeterShowMeter Pause]

; ================================================
;  METERS
; ================================================

[Play]
Meter=String
MeterStyle=styleTitle
Text=Play
LeftMouseDownAction=!Execute [!RainmeterPluginBang "mPlayer PlayPause"] [!RainmeterHideMeter Play] [!RainmeterShowMeter Pause]
Hidden=1
H=50
W=100
X=355
Y=162

[Pause]
Meter=String
MeterStyle=styleTitle
Text=Pause
LeftMouseDownAction=!Execute [!RainmeterPluginBang "mPlayer PlayPause"] [!RainmeterShowMeter Play] [!RainmeterHideMeter Pause]
Hidden=1
Edit: I was able to figure it out, I used the !RainmeterSetVariable bang to replace the Text string, works like a charm :D
H=50
W=100
X=355
Y=162
Last edited by iConic on May 11th, 2011, 6:31 am, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Help] IfAction replace text string

Post by jsmorley »

If I understand correctly, you want to use one meter for the two you have now. That is certainly doable.

[Variables]
CurrentState=Pause

; ================================================
; MEASURES
; ================================================

[mPlayPause]
Measure=Plugin
Plugin=NowPlaying.dll
MediaPlayer=[mPlayer]
MediaType=STATE
Update=500
IfAboveValue=1
IfAboveAction=!Execute [!RainmeterSetVariable CurrentState Play]
IfBelowValue=1
IfBelowAction=!Execute [!RainmeterSetVariable CurrentState Play]
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterSetVariable CurrentState Pause]

; ================================================
; METERS
; ================================================

[PlayAndPause]
Meter=String
MeterStyle=styleTitle
Text=#CurrentState#
DynamicVariables=1

H=50
W=100
X=355
Y=162
iConic
Posts: 11
Joined: May 10th, 2011, 6:01 pm

Re: [Help] IfAction replace text string

Post by iConic »

Haha thank you, I didn't understand how to use the SetVariable bang earlier, I thought I'd just test around with it until I figured it out, fortunately I figured it out, now I need to figure out how to work these bars to make a volume and song progression bar

is it possible to adjust the song time by sliding a knob on a bar like an actual media player?
or with the Volume Bar?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Help] IfAction replace text string

Post by jsmorley »

iConic wrote:Haha thank you, I didn't understand how to use the SetVariable bang earlier, I thought I'd just test around with it until I figured it out, fortunately I figured it out, now I need to figure out how to work these bars to make a volume and song progression bar

is it possible to adjust the song time by sliding a knob on a bar like an actual media player?
or with the Volume Bar?
There is no "slide" in Rainmeter. The best you can do is have a meter that when you click it sends a command to the player plugin to take whatever action you want in some increment. I don't use a music player in Rainmeter, so I have no idea what is supported with what player or plugin though. I have seen volume controls done that way though. Just arrow buttons like << and >> that send a bang to the plugin to decrease or increase the volume by 10%.
iConic
Posts: 11
Joined: May 10th, 2011, 6:01 pm

Re: [Help] IfAction replace text string

Post by iConic »

Okay thank you, that answered my question, maybe I'll just have a volume bar with buttons on both end
and then just the bar for song progression with the time string on the end or something thank you