For the first we should define some conformity. As we know, NowPlaying plugin support 8 types of players: AIMP, CAD, iTunes, MediaMonkey, WinAmp, WMP, Spotify, WLM. The list is here. So we can make next conformity: 1 = AIMP, 2 = CAD, 3 = iTunes etc. We need 2 variables for this. Let's make it:
Code: Select all
[Variables]
Player_Name=
Player_Selection=0
Code: Select all
[f.Player_Selection]
Measure=Calc
DynamicVariables=1
ifCondition=#Player_Selection# < 1
ifTrueAction=[!SetVariable Player_Selection "8"][!WriteKeyValue Variables Player_Selection "8" "Switcher.ini"][!SetVariable Player_Name "AIMP"][!WriteKeyValue Variables Player_Name "AIMP" "Switcher.ini"]
ifCondition2=#Player_Selection# > 8
ifTrueAction2=[!SetVariable Player_Selection "1"][!WriteKeyValue Variables Player_Selection "1" "Switcher.ini"][!SetVariable Player_Name "WLM"][!WriteKeyValue Variables Player_Name "WLM" "Switcher.ini"]
ifCondition3=#Player_Selection# = 1
ifTrueAction3=[!SetVariable Player_Name "AIMP"][!WriteKeyValue Variables Player_Name "AIMP" "Switcher.ini"]
ifCondition4=#Player_Selection# = 2
ifTrueAction4=[!SetVariable Player_Name "CAD"][!WriteKeyValue Variables Player_Name "CAD" "Switcher.ini"]
ifCondition5=#Player_Selection# = 3
ifTrueAction5=[!SetVariable Player_Name "ITUNES"][!WriteKeyValue Variables Player_Name "ITUNES" "Switcher.ini"]
ifCondition6=#Player_Selection# = 4
ifTrueAction6=[!SetVariable Player_Name "MEDIAMONKEY"][!WriteKeyValue Variables Player_Name "MEDIAMONKEY" "Switcher.ini"]
ifCondition7=#Player_Selection# = 5
ifTrueAction7=[!SetVariable Player_Name "WINAMP"][!WriteKeyValue Variables Player_Name "WINAMP" "Switcher.ini"]
ifCondition8=#Player_Selection# = 6
ifTrueAction8=[!SetVariable Player_Name "WMP"][!WriteKeyValue Variables Player_Name "WMP" "Switcher.ini"]
ifCondition9=#Player_Selection# = 7
ifTrueAction9=[!SetVariable Player_Name "SPOTIFY"][!WriteKeyValue Variables Player_Name "SPOTIFY" "Switcher.ini"]
ifCondition10=#Player_Selection# = 8
ifTrueAction10=[!SetVariable Player_Name "WLM"][!WriteKeyValue Variables Player_Name "WLM" "Switcher.ini"]
But we still need something what will change our #Player_Selection# variable. Let's try some magic:
Code: Select all
[t.Scroll_Example]
Meter=String
Y=80
X=0
W=200
H=40
Text="SCROLL ME"
SolidColor=100, 100, 100, 100
FontColor=200, 200, 150, 255
FontSize=24
FontFace=ARIAL
StringAlign=Left
AntiAlias=1
DynamicVariables=1
MouseScrollUpAction=[!SetVariable Player_Selection "(#Player_Selection# + 1)"][!WriteKeyValue Variables Player_Selection "(#Player_Selection# + 1)" "Switcher.ini"][!Update]
MouseScrollDownAction=[!SetVariable Player_Selection "(#Player_Selection# - 1)"][!WriteKeyValue Variables Player_Selection "(#Player_Selection# - 1)" "Switcher.ini"][!Update]
All that left it is to use our #Player_Name# in NowPlaying measure. Do no forget to set DynamicVariables on:
Code: Select all
[Player]
Measure=NowPlaying
PlayerName=#Player_Name#
DynamicVariables=1
UPDATE:
Enhanced edition by balala with a beautiful scrolling effect based on ActionTimer:
Code: Select all
[Metadata]
Name=PlayerSwitcher
Version=1.1
Author=balala (http://balazslaci.deviantart.com/) | deflore08 (deflore08@gmail.com)
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Information=Simple switcher example
[Variables]
Player_Name=AIMP
Player_Selection=1
Player_NameUp=WLM
Player_SelectionUp=8
Player_NameDown=CAD
Player_SelectionDown=2
U=[!UpdateMeasure "MeasureScroll"][!UpdateMeasure "MeasureY"][!UpdateMeterGroup "Names"][!Redraw]
Y=0
[Background]
Meter=Image
W=200
H=150
SolidColor=0,0,0,180
; - #Player_Selection# sets player name depending on it's value from 1 to 8. (1=AIMP; 2=CAD; 3=iTunes; 4=MediaMonkey; 5=Winamp; 6=WMP; 7=Spotify; 8=WLM)
[MeasureScroll]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Up,20,10
Up=[!SetVariable Y "(Clamp((#Y#-1),-10,10))"]#U#
ActionList2=Repeat Down,20,10
Down=[!SetVariable Y "(Clamp((#Y#+1),-10,10))"]#U#
DynamicVariables=1
[MeasureY]
Measure=Calc
Formula=#Y#
IfCondition=(#CURRENTSECTION#=-10)
IfTrueAction=[!SetVariable Y "0"][!SetVariable Player_Selection "((#Player_Selection#=1)?8:(#Player_Selection#-1))"][!SetVariable Player_SelectionUp "((#Player_SelectionUp#=1)?8:(#Player_SelectionUp#-1))"][!SetVariable Player_SelectionDown "((#Player_SelectionDown#=1)?8:(#Player_SelectionDown#-1))"][!UpdateMeasure "f.Player_Selection"][!WriteKeyValue Variables Player_Selection "((#Player_Selection#=1)?8:(#Player_Selection#-1))"][!WriteKeyValue Variables Player_SelectionUp "((#Player_SelectionUp#=1)?8:(#Player_SelectionUp#-1))"][!WriteKeyValue Variables Player_SelectionDown "((#Player_SelectionDown#=1)?8:(#Player_SelectionDown#-1))"][!UpdateMeasure "f.Player_Selection"]#U#
IfCondition2=(#CURRENTSECTION#=10)
IfTrueAction2=[!SetVariable Y "0"][!SetVariable Player_Selection "((#Player_Selection#=8)?1:(#Player_Selection#+1))"][!SetVariable Player_SelectionUp "((#Player_SelectionUp#=8)?1:(#Player_SelectionUp#+1))"][!SetVariable Player_SelectionDown "((#Player_SelectionDown#=8)?1:(#Player_SelectionDown#+1))"][!WriteKeyValue Variables Player_Selection "((#Player_Selection#=8)?1:(#Player_Selection#+1))"][!WriteKeyValue Variables Player_SelectionUp "((#Player_SelectionUp#=8)?1:(#Player_SelectionUp#+1))"][!WriteKeyValue Variables Player_SelectionDown "((#Player_SelectionDown#=8)?1:(#Player_SelectionDown#+1))"][!UpdateMeasure "f.Player_Selection"]#U#
DynamicVariables=1
[f.Player_Selection]
Measure=Calc
DynamicVariables=1
IfCondition=#Player_Selection#=1
IfTrueAction=[!SetVariable Player_Name "AIMP"][!SetVariable Player_NameUp "WLM"][!SetVariable Player_NameDown "CAD"][!WriteKeyValue Variables Player_Name "AIMP" "Switcher.ini"][!WriteKeyValue Variables Player_NameUp "WLM"][!WriteKeyValue Variables Player_NameDown "CAD"]
IfCondition2=#Player_Selection#=2
IfTrueAction2=[!SetVariable Player_Name "CAD"][!SetVariable Player_NameUp "AIMP"][!SetVariable Player_NameDown "ITUNES"][!WriteKeyValue Variables Player_Name "CAD" "Switcher.ini"][!WriteKeyValue Variables Player_NameUp "AIMP"][!WriteKeyValue Variables Player_NameDown "ITUNES"]
IfCondition3=#Player_Selection#=3
IfTrueAction3=[!SetVariable Player_Name "ITUNES"][!SetVariable Player_NameUp "CAD"][!SetVariable Player_NameDown "MEDIAMONKEY"][!WriteKeyValue Variables Player_Name "ITUNES" "Switcher.ini"][!WriteKeyValue Variables Player_NameUp "CAD"][!WriteKeyValue Variables Player_NameDown "MEDIAMONKEY"]
IfCondition4=#Player_Selection#=4
IfTrueAction4=[!SetVariable Player_Name "MEDIAMONKEY"][!SetVariable Player_NameUp "ITUNES"][!SetVariable Player_NameDown "WINAMP"][!WriteKeyValue Variables Player_Name "MEDIAMONKEY" "Switcher.ini"][!WriteKeyValue Variables Player_NameUp "ITUNES"][!WriteKeyValue Variables Player_NameDown "WINAMP"]
IfCondition5=#Player_Selection#=5
IfTrueAction5=[!SetVariable Player_Name "WINAMP"][!SetVariable Player_NameUp "MEDIAMONKEY"][!SetVariable Player_NameDown "WMP"][!WriteKeyValue Variables Player_Name "WINAMP" "Switcher.ini"][!WriteKeyValue Variables Player_NameUp "MEDIAMONKEY"][!WriteKeyValue Variables Player_NameDown "EMP"]
IfCondition6=#Player_Selection#=6
IfTrueAction6=[!SetVariable Player_Name "WMP"][!SetVariable Player_NameUp "WINAMP"][!SetVariable Player_NameDown "SPOTIFY"][!WriteKeyValue Variables Player_Name "WMP" "Switcher.ini"][!WriteKeyValue Variables Player_NameUp "WINAMP"][!WriteKeyValue Variables Player_NameDown "SPOTIFY"]
IfCondition7=#Player_Selection#=7
IfTrueAction7=[!SetVariable Player_Name "SPOTIFY"][!SetVariable Player_NameUp "WMP"][!SetVariable Player_NameDown "WLM"][!WriteKeyValue Variables Player_Name "SPOTIFY" "Switcher.ini"][!WriteKeyValue Variables Player_NameUp "WMP"][!WriteKeyValue Variables Player_NameDown "WLM"]
IfCondition8=#Player_Selection#=8
IfTrueAction8=[!SetVariable Player_Name "WLM"][!SetVariable Player_NameUp "SPOTIFY"][!SetVariable Player_NameDown "AIMP"][!WriteKeyValue Variables Player_Name "WLM" "Switcher.ini"][!WriteKeyValue Variables Player_NameUp "SPOTIFY"][!WriteKeyValue Variables Player_NameDown "AIMP"]
[t.Scroll_Example]
Meter=String
Y=80
X=0
W=200
H=40
Text="SCROLL ME"
SolidColor=100, 100, 100, 100
FontColor=200, 200, 150, 255
FontSize=24
FontFace=ARIAL
StringAlign=Left
AntiAlias=1
DynamicVariables=1
MouseScrollUpAction=[!CommandMeasure "MeasureScroll" "Execute 1"][!CommandMeasure "MeasureScroll" "Stop 2"]
MouseScrollDownAction=[!CommandMeasure "MeasureScroll" "Stop 1"][!CommandMeasure "MeasureScroll" "Execute 2"]
[PlayerNameContainer]
Meter=Image
SolidColor=0,0,0
X=0
Y=20
W=200
H=24
UpdateDivider=-1
[t.Player_NameUp]
Meter=String
Y=(-40+2*(10-#Y#))
X=0
W=200
H=40
Text=#Player_SelectionUp#: #Player_NameUp#
FontColor=200, 200, 150, 255
FontSize=16
FontFace=ARIAL
StringAlign=Left
AntiAlias=1
DynamicVariables=1
Container=PlayerNameContainer
Group=Names
[t.Player_Name]
Meter=String
Y=(-20+2*(10-#Y#))
X=0r
W=200
H=40
Text=#Player_Selection#: #Player_Name#
FontColor=200, 200, 150, 255
FontSize=16
FontFace=ARIAL
StringAlign=Left
AntiAlias=1
DynamicVariables=1
Container=PlayerNameContainer
Group=Names
[t.Player_NameDown]
Meter=String
Y=(2*(10-#Y#))
X=0r
W=200
H=40
Text=#Player_SelectionDown#: #Player_NameDown#
FontColor=200, 200, 150, 255
FontSize=16
FontFace=ARIAL
StringAlign=Left
AntiAlias=1
DynamicVariables=1
Container=PlayerNameContainer
Group=Names
UPDATE:
Another solution from Yincognito. A little harder, but more reliable and protected. A bugs prevented.
Code: Select all
[Variables]
Players="AIMP,CAD,iTunes,MediaMonkey,Winamp,WMP,Spotify,WLM"
PlayerCount=8
PlayerUpIndex=6
PlayerUp=Spotify
U=[!UpdateMeasure "Scroll"][!UpdateMeter *][!Redraw]
Y=0
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Metadata]
Name=PlayerSwitcher
Version=1.2
Author= THE RAINMETER COMMUNITY AND THE HOLY SPIRIT feat balala (http://balazslaci.deviantart.com/) | Yincognito (https://www.deviantart.com/yincognyto)| deflore08 (deflore08@gmail.com)
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Information=Simple switcher example
---Measures---
[Scroll]
Group=ScrollGroup
Measure=Plugin
Plugin=ActionTimer
ActionList1=UpdateUp | Wait 5 | Repeat Up,15,24 | Wait 5
Up=[!SetVariable Y (Clamp((#Y#+1),-24,0))]#U#
UpdateUp=[!SetVariable PlayerUpIndex ((#PlayerCount#+#PlayerUpIndex#-1)%#PlayerCount#)][!SetVariable Y -24][!UpdateMeasureGroup "ScrollGroup"]#U#
ActionList2=Repeat Down,15,24 | Wait 5 | UpdateDown | Wait 5
Down=[!SetVariable Y (Clamp((#Y#-1),-24,0))]#U#
UpdateDown=[!SetVariable PlayerUpIndex ((#PlayerCount#+#PlayerUpIndex#+1)%#PlayerCount#)][!SetVariable Y 0][!UpdateMeasureGroup "ScrollGroup"]#U#
DynamicVariables=1
[PlayerUpIndex]
Group=ScrollGroup
Measure=Calc
Formula=(#PlayerUpIndex#)
UpdateDivider=-1
OnUpdateAction=[!WriteKeyValue Variables PlayerUpIndex [PlayerUpIndex]]
DynamicVariables=1
[PlayerUp]
Group=ScrollGroup
Measure=String
String="#Players#,"
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(?U)^(?:.*,){[PlayerUpIndex]}(.*),.*$":"\1"
OnUpdateAction=[!WriteKeyValue Variables PlayerUp "[PlayerUp]"]
DynamicVariables=1
[PlayerDownIndex]
Group=ScrollGroup
Measure=Calc
Formula=((#PlayerCount#+#PlayerUpIndex#+1)%#PlayerCount#)
UpdateDivider=-1
DynamicVariables=1
[PlayerDown]
Group=ScrollGroup
Measure=String
String="#Players#,"
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(?U)^(?:.*,){[PlayerDownIndex]}(.*),.*$":"\1"
DynamicVariables=1
---Meters---
[Background]
Meter=Image
W=200
H=150
SolidColor=0,0,0,180
[Container]
Meter=Image
SolidColor=0,0,0,255
X=0
Y=20
W=200
H=24
[PlayerUpName]
Container=Container
Group=NamesGroup
Meter=String
X=10
Y=(#Y#)
W=190
H=24
FontColor=200,200,150,255
FontSize=16
FontFace=Arial
StringAlign=Left
AntiAlias=1
MeasureName=PlayerUpIndex
MeasureName2=PlayerUp
Text="%1: %2"
DynamicVariables=1
[PlayerDownName]
Container=Container
Group=NamesGroup
Meter=String
X=0r
Y=0R
W=190
H=24
FontColor=200,200,150,255
FontSize=16
FontFace=Arial
StringAlign=Left
AntiAlias=1
MeasureName=PlayerDownIndex
MeasureName2=PlayerDown
Text="%1: %2"
DynamicVariables=1
[ScrollText]
Meter=String
X=100
Y=80
W=200
H=40
SolidColor=100,100,100,100
FontColor=200,200,150,255
FontSize=24
FontFace=Arial
StringAlign=Center
AntiAlias=1
Text="SCROLL ME"
MouseScrollUpAction=[!CommandMeasure Scroll "Stop 2"][!CommandMeasure Scroll "Execute 1"]
MouseScrollDownAction=[!CommandMeasure Scroll "Stop 1"][!CommandMeasure Scroll "Execute 2"]
DynamicVariables=1