It is currently October 19th, 2024, 4:25 pm

Mond - Can't Find Image Path

Get help with creating, editing & fixing problems with skins
StratoVirus
Posts: 2
Joined: September 2nd, 2024, 6:48 pm

Mond - Can't Find Image Path

Post by StratoVirus »

I have a weird issue when I'm using the Mond Player skin. I'm using Foobar2000 as my media player and using the stock Player.ini code. When songs are in a Stopped/Paused state I get the Play.png to be displayed, and I can see the correct MeasureStateButton state displayed as '2' and it displays the correct file path. However, when I am playing a song the Pause.png is not displayed and the MeasureStateButton state displays as '1', but the file path is wrong..very wrong. Not sure if this matters, but my Rainmeter skin file path is on a shared drive. All the image files for the buttons are in the @Resource folder.

Player.ini - Snipped to the MeasureStateButton portion for brevity

Code: Select all

[MeasureStateButton]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#Player#
PlayerType=STATE
Substitute="0":"#@#Play.png","1":"#@#Pause.png","2":"#@#Play.png"
Correct Response - File path for the Stopped/Paused state

Code: Select all

\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png
Wrong Response - File path for the Play state

Code: Select all

\\19\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png.168.XXX.\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png0\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png
I have a workaround which is to hardcode the Play state file path but I rather avoid hardcoding things.

Any ideas how to fix this? Thanks.
User avatar
Yincognito
Rainmeter Sage
Posts: 8496
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mond - Can't Find Image Path

Post by Yincognito »

StratoVirus wrote: September 2nd, 2024, 7:00 pm Player.ini - Snipped to the MeasureStateButton portion for brevity

Code: Select all

[MeasureStateButton]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#Player#
PlayerType=STATE
Substitute="0":"#@#Play.png","1":"#@#Pause.png","2":"#@#Play.png"
Correct Response - File path for the Stopped/Paused state

Code: Select all

\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png
Wrong Response - File path for the Play state

Code: Select all

\\19\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png.168.XXX.\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png0\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png
I have a workaround which is to hardcode the Play state file path but I rather avoid hardcoding things.

Any ideas how to fix this? Thanks.
This looks like you're trying to substitute your actual Pause.png path with the paths to Play.png or Pause.png, instead of replacing the numerical 0, 1 or 2 values of the PlayerType=State measure. Check these and you'll understand what happens (I replaced the NowPlaying measures with some Calc and String ones, simply to replicate various results):

Code: Select all

[Good1]
Measure=Calc
Formula=2
Substitute="0":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png","1":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png","2":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"

[Good2]
Measure=Calc
Formula=2
RegExpSubstitute=1
Substitute="^0$":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png","^1$":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png","^2$":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"

[Bad1]
Measure=String
String="\\192.168.XXX.202\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png"
Substitute="2":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"
Normally, even without using RegExpSubstitute=1 and the ^ and $ anchors for the start and end of the string in the pattern, in order to restrict the substitution to happen only once for the "0", "1" and "2" strings and not for every 0, 1 or 2 within a string, what you experienced shouldn't have occured. The main possibility is that you're performing the substitution on the wrong value (e.g. some actual path instead of the NowPlaying state number).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5543
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Mond - Can't Find Image Path

Post by eclectic-tech »

Substitutions ae done in a progressive order; the first substitution is performed and passed on to the second substitution, and so on... that is why only your last substitution gave the desired result.

What you need to do in this case is to use RegExpSubstitute=1 and restrict the substations to exactly the one single digit using line beginning ^ and line end $ symbols as Yincognito suggested. This will prevent the second and third substitutions from substituting all matching values in the previous substitution string.

-=-
Where substitution can go wrong... If you do not use RegExpSubstition=1 and restrict the match to a set of unique characters, this is what happens:

All images are located at: \\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png

Your normal substitution: Substitute="0":"#@#Play.png","1":"#@#Pause.png","2":"#@#Play.png"

When the STATE is zero, the "0" is replaced with a resulting string of:

"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"

So far so good, but...That string value is sent to the next substitution, where every "1" is replaced with \\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png" with a resulting string of:

"\\\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png92.\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png68.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"

Things are getting messy, but wait... That string is passed to the last substitution, where every "2" is replaced with \\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png with a resulting string of:

"\\\\19\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png9\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png.\\19\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png68.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"

-=-
Okay, that's not what you want as results, so how do you make it work?

The correct way to substitute for defined characters (as suggested by Yincognito):

Code: Select all

[MeasureStateButton]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#Player#
PlayerType=STATE
RegExpSubstitution=1
Substitute="^0$":"#@#Play.png","^1$":"#@#Pause.png","^2$":"#@#Play.png"
When the STATE is "0" the entire substitution result is: "\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"
No other substitutions are done because the "1", and "2" values are NOT individual characters, they are combined with other characters.

When the STATE is "1" the entire substitution result is: "\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png"
No other substitutions are done because the "2" values are NOT individual characters, they are combined with other characters.

When the STATE is "2" the entire substitution result is: "\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"

Hope this help explain a bit better...
Remember that normal Substitutions are done in the order they appear from first to last, with the previous substitutions used for the next substitution. RegExpSubstitution=1 allows you to define specific string values and control what is substituted and when.
User avatar
Yincognito
Rainmeter Sage
Posts: 8496
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mond - Can't Find Image Path

Post by Yincognito »

eclectic-tech wrote: September 3rd, 2024, 11:03 pm "\\\\19\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png9\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png.\\19\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png68.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"
That's what I thought to at first, since it makes perfect sense like you explained. The thing is, the wrong result from the OP doesn't contain the four backslash characters at the start, nor the alternate Play.png and Pause.png paths (see my Bad1 measure)... :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5543
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Mond - Can't Find Image Path

Post by eclectic-tech »

Yincognito wrote: September 4th, 2024, 7:27 am That's what I thought to at first, since it makes perfect sense like you explained. The thing is, the wrong result from the OP doesn't contain the four backslash characters at the start, nor the alternate Play.png and Pause.png paths (see my Bad1 measure)... :???:
I believe the RegExpSubstitute will use the 'escaped' value of '\\\\' and display it as '\\' ...
I just copied the paths and may not have all the substitutes correct :Whistle

Personally, I would have just used normal substitute and replaced the numbers with only the image name.
Then in the meter use ImagePath=#@#... that seems simpler than using RegExpSubstitute, but both should work.

Code: Select all

[MeasureStateButton]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#Player#
PlayerType=STATE
Substitute="0":"Play.png","1":"Pause.png","2":"Play.png"

...

[MeterPlayPause]
Meter=Image
MeasureName-MeasureStateButton
ImagePath=#@#

...
User avatar
Yincognito
Rainmeter Sage
Posts: 8496
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Mond - Can't Find Image Path

Post by Yincognito »

eclectic-tech wrote: September 4th, 2024, 11:23 am Personally, I would have just used normal substitute and replaced the numbers with only the image name.
Then in the meter use ImagePath=#@#... that seems simpler than using RegExpSubstitute, but both should work.
That would have avoided the issue altogether, indeed. ;-)
eclectic-tech wrote: September 4th, 2024, 11:23 am I believe the RegExpSubstitute will use the 'escaped' value of '\\\\' and display it as '\\' ...
There's nothing escaped in the pattern though, and in the replacement escaping doesn't count:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

---Measures---

[Bad2]
Measure=Calc
Formula=0
Substitute="0":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png","1":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Pause.png","2":"\\192.168.XXX.XXX\XXXData\Documents\Rainmeter\Skins\Mond\@Resources\Play.png"

---Meters---

[Result]
Meter=String
SolidColor=000000
FontColor=FFFFFF
W=600
ClipString=2
InlineSetting =Color | 0040FF
InlinePattern =^(.{2}).{4}.{76}.{72}(.{1}).{76}.{5}.{76}.{72}(.{69})
InlineSetting2=Color | 008000
InlinePattern2=^.{2}(.{4}).{76}(.{72}).{1}.{76}(.{5}).{76}(.{72}).{69}
InlineSetting3=Color | FF8000
InlinePattern3=^.{2}.{4}(.{76}).{72}.{1}(.{76}).{5}(.{76}).{72}.{69}
MeasureName=Bad2
Text=%1
DynamicVariables=1
Which means that the OP's "wrong response" is inaccurate, and it isn't even for the Play state (i.e. the result for Formula=1 above). He must have presented the response simply as an example, to illustrate the repeated substitution happening without using regular expressions...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
StratoVirus
Posts: 2
Joined: September 2nd, 2024, 6:48 pm

Re: Mond - Can't Find Image Path

Post by StratoVirus »

eclectic-tech wrote: September 4th, 2024, 11:23 am I believe the RegExpSubstitute will use the 'escaped' value of '\\\\' and display it as '\\' ...
I just copied the paths and may not have all the substitutes correct :Whistle

Personally, I would have just used normal substitute and replaced the numbers with only the image name.
Then in the meter use ImagePath=#@#... that seems simpler than using RegExpSubstitute, but both should work.

Code: Select all

[MeasureStateButton]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#Player#
PlayerType=STATE
Substitute="0":"Play.png","1":"Pause.png","2":"Play.png"

...

[MeterPlayPause]
Meter=Image
MeasureName-MeasureStateButton
ImagePath=#@#

...
This worked well! Thanks for the help. I think the skin creator wasn't expecting someone to have their Rainmeter skins stored on a NAS.