Solved XBMC.RunScript Run Twice
#1
Hello everyone,
I'am facing a slight problem with running my custom made script when attaching it to an <onclick> event for a button in the skin xmls
Code:
<onclick>XBMC.RunScript("special://home/addons\path_to_my_python_script")</onclick>

The script itself actually runs fine but the problem occur when i double tap the button with the keyboard either by accident or intentionally; Two different version of the script will get executed and cause it to malfunction all-together.

Is there a solution to this ? like disabling the button on an <onclick> event for a short period of time, i have searched the wiki for a built-in function to disable skin buttons with no luck and i can't access that xml from python cause its a skin xml.

Anyone encountered this problem before ? i would appreciate it if someone could help !
Thanks.
I wrote a program to program my program ! - programception.
Reply
#2
Your best bet is to use skin properties. Test for it on run. Set it if not already set, exit script if it is set, clear it after the script successfully runs.
Reply
#3
(2014-02-26, 21:22)giftie Wrote: Your best bet is to use skin properties. Test for it on run. Set it if not already set, exit script if it is set, clear it after the script successfully runs.

I agree, more details can be found here.
http://forum.xbmc.org/showthread.php?tid=97353
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#4
(2014-02-27, 01:17)Lunatixz Wrote:
(2014-02-26, 21:22)giftie Wrote: Your best bet is to use skin properties. Test for it on run. Set it if not already set, exit script if it is set, clear it after the script successfully runs.

I agree, more details can be found here.
http://forum.xbmc.org/showthread.php?tid=97353

Strange how things come around..
Reply
#5
(2014-02-27, 02:03)giftie Wrote:
(2014-02-27, 01:17)Lunatixz Wrote:
(2014-02-26, 21:22)giftie Wrote: Your best bet is to use skin properties. Test for it on run. Set it if not already set, exit script if it is set, clear it after the script successfully runs.

I agree, more details can be found here.
http://forum.xbmc.org/showthread.php?tid=97353

Strange how things come around..

Yeah, lol
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#6
(2014-02-26, 21:22)giftie Wrote: Your best bet is to use skin properties. Test for it on run. Set it if not already set, exit script if it is set, clear it after the script successfully runs.

@giftie: Thanks a million, you solved my issue and pointed me in the right direction.
Here is what i had to do if anyone was having the same problem:

Code:
def __init__(self, strXMLname, strFallbackPath, strDefaultName, forceFallback):
    if(not xbmc.getCondVisibility("Skin.HasSetting(script_running)")):
        xbmc.executebuiltin("Skin.SetBool(script_running)")
        #Go on with my business
    else:
        self.close()
and doing Skin.Reset(script_running) when exiting the script

@Lunatixz: Hah looks like giftie was in my seat 4 years ago Big Grin, thanks though Smile
I wrote a program to program my program ! - programception.
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC.RunScript Run Twice0