Kodi Community Forum

Full Version: String.Contains function.....helpppp....
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i'd like to use string.contains for addon settings, but i don't get the setting visble.
i use this condition for visible attribute:
Code:
visible="String.Contains(System.OSVersionInfo,Windows 7)"
how to fix and get it visible?
(2017-11-21, 17:50)harryberlin Wrote: [ -> ]i'd like to use string.contains for addon settings, but i don't get the setting visble.
i use this condition for visible attribute:
Code:
visible="String.Contains(System.OSVersionInfo,Windows 7)"
how to fix and get it visible?  
 All depends on the returned string, so check using a label to see what is shown for System.OSVersionInfo.
The Label shows this string:
Code:
Windows 7 SP1 (kernel: Windows NT 6.1)
Maybe try -

xml:
visible="String.Contains(System.OSVersionInfo,Windows)" + "String.Contains(System.OSVersionInfo,7)"
the problem with the System.OSVersionInfo infolabel is that it takes a while for kodi to retrieve the value.
if a use it in a skin label, it will initially display 'Busy' for a fraction of a second.

when testing it in addon settings, the first time i open the settings, the visible condition returns false,
but after closing and re-opening the settings, it will return true.


(moved your question to addon dev)
i never get it visible.
it's in a further category. not first category.
the full setting example is this:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="one">
</category>
<category label="two">
</category>
<category label="three">
</category>
<category label="PiBUS">
<description>PiBus</description>
<setting label="Install Shutdown script for LibreElec" type="action" action="" id="pibus_install_power_off" enable="true" visible="String.Contains(System.OSVersionInfo,Windows 7)" />
</category>
<category label="five">
</category>
</settings>
(2017-11-22, 09:50)harryberlin Wrote: [ -> ]i never get it visible.
it's in a further category. not first category.
the full setting example is this:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="one">
</category>
<category label="two">
</category>
<category label="three">
</category>
<category label="PiBUS">
<description>PiBus</description>
<setting label="Install Shutdown script for LibreElec" type="action" action="" id="pibus_install_power_off" enable="true" visible="String.Contains(System.OSVersionInfo,Windows 7)" />
</category>
<category label="five">
</category>
</settings>
can't test on windows, but if i adopt the condition for linux, it works as for me the second time i enter settings.