Hey guys,
I was making my iTunes config today, but I came along a problem I didn't know how to solve.
Currently I have this: Text="by %1",
but what I want is this (in pseudocode):
if (GetCurrentTrackArtist = NULL)
{
Text=""
}
else
{
Text="by %1"
}
So basically what I want is that when GetCurrentTrackArtist gives no value, I don't want it to show "by" on my desktop.
Any ideas?
It is currently April 27th, 2024, 5:41 pm
If/Else in Rainmeter
-
- Posts: 5
- Joined: February 21st, 2011, 8:12 pm
-
- Posts: 271
- Joined: February 16th, 2011, 12:46 am
- Location: California
Re: If/Else in Rainmeter
you could throw a substitute in there... so something like my WinAmp skin:
Hope it helps... if not, I could rig an iTunes code for you... I think.
Btw - I used those subs so that my WinAmp sounded more English. Cuz English rock is awesome.
Code: Select all
Measure=Plugin
Plugin=Plugins\WindowMessagePlugin.dll
WindowClass=Winamp v1.x
WindowMessage=1024 0 104
MinValue=0
MaxValue=3
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterShowMeter MeterPause][!RainmeterHideMeter MeterPlay]
IfAboveValue=1
IfAboveAction=!Execute [!RainmeterShowMeter MeterPlay][!RainmeterHideMeter MeterPause]
IfBelowValue=1
IfBelowAction=!Execute [!RainmeterShowMeter MeterPlay][!RainmeterHideMeter MeterPause]
Substitute="0":"suspended","1":"engaged","3":"paused"
Btw - I used those subs so that my WinAmp sounded more English. Cuz English rock is awesome.
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: If/Else in Rainmeter
Something like this should work.
[Variables]
ArtistPrefix=""
[MeasureArtistName]
Measure=Plugin
Blah...
Substitute="":"-1"
[MeasureCheckArtist]
Measure=Calc
Formula=[MeasureArtistName]
IfBelowValue=0
IfBelowAction=!RainmeterSetVariable ArtistPrefix ""
IfEqualValue=0
IfEqualAction=!RainmeterSetVariable ArtistPrefix "by "
DynamicVariables=1
[MeterArtist]
Meter=String
MeasureName=MeasureArtistName
Text=#ArtistPrefix#%1
DynamicVariables=1
[Variables]
ArtistPrefix=""
[MeasureArtistName]
Measure=Plugin
Blah...
Substitute="":"-1"
[MeasureCheckArtist]
Measure=Calc
Formula=[MeasureArtistName]
IfBelowValue=0
IfBelowAction=!RainmeterSetVariable ArtistPrefix ""
IfEqualValue=0
IfEqualAction=!RainmeterSetVariable ArtistPrefix "by "
DynamicVariables=1
[MeterArtist]
Meter=String
MeasureName=MeasureArtistName
Text=#ArtistPrefix#%1
DynamicVariables=1
-
- Posts: 5
- Joined: February 21st, 2011, 8:12 pm
Re: If/Else in Rainmeter
Hmm didn't work, thanks for the help though.
I also tried to simply Substitute="by ":"", but that didn't help either.
Maybe your code doesn't work because it doesn't support iTunes?
I also tried to simply Substitute="by ":"", but that didn't help either.
Maybe your code doesn't work because it doesn't support iTunes?
-
- Posts: 5
- Joined: February 21st, 2011, 8:12 pm
Re: If/Else in Rainmeter
Yeah it kind of works, but now I simply get "-1" on my desktop instead of "by".jsmorley wrote:Something like this should work.
[Variables]
ArtistPrefix=""
[MeasureArtistName]
Measure=Plugin
Blah...
Substitute="":"-1"
[MeasureCheckArtist]
Measure=Calc
Formula=[MeasureArtistName]
IfBelowValue=0
IfBelowAction=!RainmeterSetVariable ArtistPrefix ""
IfEqualValue=0
IfEqualAction=!RainmeterSetVariable ArtistPrefix "by "
DynamicVariables=1
[MeterArtist]
Meter=String
Text=#ArtistPrefix#%1
DynamicVariables=1
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: If/Else in Rainmeter
Yeah, give me a sec. I was just looking at it. Probably going to have to move the substitute.DonDemon wrote: Yeah it kind of works, but now I simply get "-1" on my desktop instead of "by".
-
- Posts: 5
- Joined: February 21st, 2011, 8:12 pm
Re: If/Else in Rainmeter
I was thinking of putting a Substitute="-1":"" at the bottom of the [MeasureCheckArtist], but that didn't work either.
-
- Posts: 5
- Joined: February 21st, 2011, 8:12 pm
Re: If/Else in Rainmeter
I somewhat fixed it.
What I did was create two separate Measures, like this:
The [MeasureDataArtist] takes care of the "by", and the [MeasureArtist] simply return a value for my Meter. But now I've got a problem that there's no "by" even when a song is playing =/, which makes no sense, actually.
EDIT: nevermind, it works now. I don't know what I did this time, but it works. Thanks.
What I did was create two separate Measures, like this:
Code: Select all
[measureDataArtist]
Measure=Plugin
Plugin=Plugins\iTunesPlugin.dll
Command=GetCurrentTrackArtist
Substitute="":"-1"
[measureArtist]
Measure=Plugin
Plugin=Plugins\iTunesPlugin.dll
Command=GetCurrentTrackArtist
EDIT: nevermind, it works now. I don't know what I did this time, but it works. Thanks.