Help with Skin.SetString(,) and StringCompare(,)
#1
Can't seem to figure out how to get StringCompare(,) to match as true the following...

PHP Code:
Skin.SetString(mystring,$INFO[Window(Home).Property(Artist)] Music Videos

PHP Code:
StringCompare(Skin.String(mystring),Window(Home).Property(ArtistMusic Videos

It seems to me this should work but it doesn't. If I remove "Music Videos" out of both of the functions it works.
Anyone have any ideas?. Thanks
Reply
#2
Try one of the following

Code:
StringCompare(Skin.String(mystring),$INFO[Window(Home).Property(Artist)] Music Videos)
StringCompare(Skin.String(mystring),$INFO[Window(Home).Property(Artist),, Music Videos])

Also try

Code:
Skin.SetString(mystring,$INFO[Window(Home).Property(Artist),, Music Videos])

Best thing is to actually check what the skin string is getting set as in your guisettings.xml.
Reply
#3
(2014-11-16, 18:22)Hitcher Wrote: Try one of the following

Code:
StringCompare(Skin.String(mystring),$INFO[Window(Home).Property(Artist)] Music Videos)
StringCompare(Skin.String(mystring),$INFO[Window(Home).Property(Artist),, Music Videos])

Also try

Code:
Skin.SetString(mystring,$INFO[Window(Home).Property(Artist),, Music Videos])

Best thing is to actually check what the skin string is getting set as in your guisettings.xml.

I tried every combination I could think of with the code you suggested but still a no go. The SetString suggestion sets the string to the given value with Music Videos after the artist name and that is what gets set in guisettings.xml but StringCompare is not picking up the value as true no matter what combination I use. One thing though... I was under the impression that StringCompare uses the window property without $INFO[] prefix.

From the wiki description for StringCompare(,) it states...

"Returns true if the info equals the string. example of info: ListItem.Title, ListItem.Genre. Please note that string can also be a $LOCALIZE[] or info label (without $INFO prefix)."

I tried it with the prefix, without the prefix and about every combination I could think of but for some reason it still won't pick it up as true.Your suggestion above to set the Skin.String() works just as expected, but StringCompare will not recognize the string as true no matter.

I tried your suggestions without " Music Videos" and it works without using the $INFO[] prefix but as soon as I add " Music Videos" to the mix. No bueno. I'm stumped. Confused
Reply
#4
Only other way then is this

Code:
SubString(Skin.String(mystring),Window(Home).Property(Artist),left) + SubString(Skin.String(mystring),Music Videos,right)
Reply
#5
(2014-11-16, 20:39)Hitcher Wrote: Only other way then is this

Code:
SubString(Skin.String(mystring),Window(Home).Property(Artist),left) + SubString(Skin.String(mystring),Music Videos,right)
Yeah, I tried SubString many different ways, and again with your suggestion above but as I understand, it's only evaluated at time of xml load and not on the fly with an arrow key press as I need. Hmmm... I just don't get it... Logic tells me StringCompare should work in this way and it does perfectly without adding Music Videos to the mix. Well, I really appreciate your help, time and expertise anyhow bro. Maybe i'll figure something out. Thanks Hitcher. Wink
Reply
#6
(2014-11-16, 21:07)woodside Wrote:
(2014-11-16, 20:39)Hitcher Wrote: Only other way then is this

Code:
SubString(Skin.String(mystring),Window(Home).Property(Artist),left) + SubString(Skin.String(mystring),Music Videos,right)
Yeah, I tried SubString many different ways, and again with your suggestion above but as I understand, it's only evaluated at time of xml load and not on the fly with an arrow key press as I need. Hmmm... I just don't get it... Logic tells me StringCompare should work in this way and it does perfectly without adding Music Videos to the mix. Well, I really appreciate your help, time and expertise anyhow bro. Maybe i'll figure something out. Thanks Hitcher. Wink

SubString() and Stringcompare() both get evaluated "on-the-fly". (in fact every visible condition gets evaluated on-the-fly)
Your "problem" is that the syntax is
Code:
<visible>Stringcompare(Skin.String(mystring),ListItem.Property(xxx))</visible>
and not
Code:
<visible>Stringcompare($INFO[Skin.String(mystring)],$INFO[ListItem.Property(xxx)])</visible>

because with the first one you can´t put anything after ListItem.Property().
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#7
(2014-11-16, 23:03)phil65 Wrote:
(2014-11-16, 21:07)woodside Wrote:
(2014-11-16, 20:39)Hitcher Wrote: Only other way then is this

Code:
SubString(Skin.String(mystring),Window(Home).Property(Artist),left) + SubString(Skin.String(mystring),Music Videos,right)
Yeah, I tried SubString many different ways, and again with your suggestion above but as I understand, it's only evaluated at time of xml load and not on the fly with an arrow key press as I need. Hmmm... I just don't get it... Logic tells me StringCompare should work in this way and it does perfectly without adding Music Videos to the mix. Well, I really appreciate your help, time and expertise anyhow bro. Maybe i'll figure something out. Thanks Hitcher. Wink

SubString() and Stringcompare() both get evaluated "on-the-fly". (in fact every visible condition gets evaluated on-the-fly)
Your "problem" is that the syntax is
Code:
<visible>Stringcompare(Skin.String(mystring),ListItem.Property(xxx))</visible>
and not
Code:
<visible>Stringcompare($INFO[Skin.String(mystring)],$INFO[ListItem.Property(xxx)])</visible>

because with the first one you can´t put anything after ListItem.Property().
Hi Phil, if you can see the first post as to what I was basically trying to accomplish. I'm actually trying to compare a window property using an <ondown> in a fake button. Is that a little different than on a ListItem.Property()? Actually I'm not trying to use it in a visible condition but rather in a conditional attribute. I'm trying to learn but sometimes the wiki isn't real clear on things for noobs.

For "on-the-fly" I was going by what the wiki descriptions says about StringCompare and SubString...Blush

StringCompare(info,string)
"Returns true if the info equals the string. example of info: ListItem.Title, ListItem.Genre. Please note that string can also be a $LOCALIZE[] or info label (without $INFO prefix). Also note that in a panelview or similar this only works on the focused item. Both arguments are evaluated on the fly, unlike substring."


SubString(info,string)
"Returns true if the string is found anywhere in the info
Parameter is evaluated at time of parsing (XML load) not on the fly."
Reply
#8
You should use Container(CONTAINER_ID).ListItem.xxx when referencing to custom lists from outside the list itself.
For Substring/Stringcompare: The wiki is wrong then I guess. Both work the same way.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#9
(2014-11-17, 02:43)phil65 Wrote: You should use Container(CONTAINER_ID).ListItem.xxx when referencing to custom lists from outside the list itself.
For Substring/Stringcompare: The wiki is wrong then I guess. Both work the same way.
thanks for the tip about using Container(CONTAINER_ID)[/b].ListItem.xxx
I'm not referencing a list to StringCompare with, but rather a window property.

Here's a post I was part of where the conversation was about StringCompare and SubString being evaluated on the fly.
jmarshall explains how they are evaluated. They wound up updating the wiki to it's current description after this conversation. Maybe they shouldn't have updated it then? I don't know... like I say i'm just a noob trying to learn
http://forum.kodi.tv/showthread.php?tid=...pid1707120
Reply
#10
@phil65

I added the wiki info about the on-the-fly evaluation. Info came from a comment by JM.

http://forum.kodi.tv/showthread.php?tid=...pid1707120
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#11
(2014-11-17, 04:43)MassIV Wrote: @phil65

I added the wiki info about the on-the-fly evaluation. Info came from a comment by JM.

http://forum.kodi.tv/showthread.php?tid=...pid1707120

Hmm usually JMarshall is always right, but I think he´s wrong on this one. I´m using a lot of Substring(Control.GetLabel(xxx),xxx) conditions in my own skin and the Control.GetLabel() value definitiely gets updated "on-the-fly".
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#12
Confirmed, definitely in the fly.
Reply
#13
Been doing a couple of tests and maybe you guys would know why this is the case.

PHP Code:
StringCompare(Skin.String(mystring),Window(Home).Property(ArtistMusic Videos
False
PHP Code:
StringCompare(Skin.String(mystring),$INFO[Window(Home).Property(Artist)] Music Videos
False

If the Artist name is "Santana"
PHP Code:
StringCompare(Skin.String(mystring),Santana Music Videos
True

PHP Code:
<control type="label">
            <
left>100</left>
            <
top>50</top>
            <
width>500</width>
            <
height>20</height>
            <
align>left</align>
            <
label>$INFO[Window(Home).Property(Artist)] Music Videos</label>
            <
font>Font_Reg28</font>
            <
textcolor>FFe8d9c5</textcolor>
            <
visible>true</visible>
        </
control

= Santana Music Videos

PHP Code:
<control type="label" id="8">
            <
left>100</left>
            <
top>100</top>
            <
width>900</width>
            <
height>667</height>
            <
align>left</align>
            <
aligny>top</aligny>
             <
label>$INFO[Skin.String(mystring)]</label>
            <
font>Font_Reg28</font>
            <
textcolor>FFe8d9c5</textcolor>
            <
visible>true</visible>
        </
control

= Santana Music Videos


Where am I going wrong here?
Shouldn't one of the 2 lines below evaluate as true if this line evaluates as true?


PHP Code:
StringCompare(Skin.String(mystring),Santana Music Videos

PHP Code:
StringCompare(Skin.String(mystring),Window(Home).Property(ArtistMusic Videos)

StringCompare(Skin.String(mystring),$INFO[Window(Home).Property(Artist)] Music Videos
Reply
#14
This works because you can tell Kodi that one part is info label and one part is plain text by using $INFO:

<label>$INFO[Window(Home).Property(Artist)] Music Videos</label>

This is the correct format but you can't use $INFO, so you can't also mix in plain text:

StringCompare(Skin.String(mystring),Window(Home).Property(Artist))



Perhaps you can get around it by making a hidden label (not in list), give the label an id, and then use Control.GetLabel(id) in your stringcompare?

StringCompare(Skin.String(mystring),Control.GetLabel(id))
Image [RELEASE] Metroid
Image [RELEASE] IrcChat
Reply
#15
(2014-11-17, 17:37)MassIV Wrote: This works because you can tell Kodi that one part is info label and one part is plain text by using $INFO:

<label>$INFO[Window(Home).Property(Artist)] Music Videos</label>

This is the correct format but you can't use $INFO, so you can't also mix in plain text:

StringCompare(Skin.String(mystring),Window(Home).Property(Artist))



Perhaps you can get around it by making a hidden label (not in list), give the label an id, and then use Control.GetLabel(id) in your stringcompare?

StringCompare(Skin.String(mystring),Control.GetLabel(id))

Ahhhhh... I see. That makes perfect sense now.

"StringCompare(Skin.String(mystring),Control.GetLabel(id))" works perfect. Thank you very much.
Reply

Logout Mark Read Team Forum Stats Members Help
Help with Skin.SetString(,) and StringCompare(,)0