button -> execture script
#1
Hi,

i want to execute a script when pressing a button.

The scripts works (if i execture it from the scripts window).

What i have to do? I didn't get it works.



What i did:

create a Keymap.xml in my userdata directory:

Code:
1 <keymap>
2   <global>
3         <remote>
4             <test>XBMC.RunScript(special://home/scripts/myscripts/volumemute.py)</test>
5         </remote>
6     </global>
7 </keymap>

And mapping that action in my Lircmap.xml

Code:
...
<test>KEY_PAUSECD</test>
...


What am I doing wrong?


Thanks!
Reply
#2
you cannot invent random remote buttons. if you need to do that, use obc button codes as explained in one of the stickies.
Reply
#3
Ah, ok.

So how can I do it? Sad
Reply
#4
allow me to quote myself!
Quote:you cannot invent random remote buttons. if you need to do that, use obc button codes as explained in one of the stickies.
!
Reply
#5
Wait: U edited the last part, dont u? Smile

Sorry, didn't saw that.
So I have to map it to one of those obc buttons and then I don't need the Lircmap.xml entry, right?
Reply
#6
yes i did, within 10 secs of accidentially hitting post. damn you were faster Smile

you still need the lircmap entries, you just map them to obc codes instead of internal button names.
Reply
#7
Strange things happening now Smile

Lircmap.xml

Code:
<lircmap>
<remote device="devinput">
<power>KEY_POWER</power>
<start>KEY_D</start>
<myTV></myTV>
<mymusic>KEY_BOOKMARKS</mymusic>
<mypictures>KEY_WWW</mypictures>
<myvideo>KEY_INFO</myvideo>
<pause>KEY_PAUSE</pause>
<play>KEY_PLAY</play>
<stop>KEY_STOP</stop>
<reverse>KEY_REWIND</reverse>
<forward>KEY_FORWARD</forward>
<skipplus>KEY_F</skipplus>
<skipminus>KEY_E</skipminus>
<record>KEY_RECORD</record>
<back>KEY_FRONT</back>
<info>KEY_END</info>
<left>KEY_LEFT</left>
<right>KEY_RIGHT</right>
<up>KEY_UP</up>
<down>KEY_DOWN</down>
<select>KEY_OK</select>
<title>KEY_PROG4</title>
<volumeplus>KEY_VOLUMEDOWN</volumeplus>
<volumeminus>KEY_VOLUMEUP</volumeminus>
<mute>KEY_A</mute>
<pageplus></pageplus>
<pageminus></pageminus>
<channelplus>KEY_CHANNELUP</channelplus>
<channelminus>KEY_CHANNELDOWN</channelminus>
<one>KEY_1</one>
<two>KEY_2</two>
<three>KEY_3</three>
<four>KEY_4</four>
<five>KEY_5</five>
<six>KEY_6</six>
<seven>KEY_7</seven>
<eight>KEY_8</eight>
<nine>KEY_9</nine>
<zero>KEY_0</zero>
<display></display>
<livetv>KEY_COFFEE</livetv>
<recordedtv>KEY_KPENTER</recordedtv>
<menu>KEY_DVD</menu>
<obc6>KEY_PAUSECD</obc6>
<clear></clear>
</remote>
</lircmap>

Keymap.xml

Code:
<keymap>
  <global>
        <universalremote>
            <obc6>XBMC.RunScript(special://home/scripts/myscripts/volumemute.py)</obc6>
        </universalremote>
    </global>
</keymap>


When i press the :KEY_PAUSECD" button xbmc opens the weather window. Why he opens the weather window instead of executing the script? :/


Here's the script if that helps

Code:
fame@scooter /home/fame/.xbmc/scripts/myscripts $ cat volumemute.py
#!/usr/bin/python
import os
cmd = '/usr/bin/amixer sset Line,0 toggle'
os.system(cmd)
Reply
#8
i said read the sticky; http://forum.xbmc.org/showthread.php?tid=45972

in particular; it's either obc1 codes OR normal mappings.
Reply
#9
I've read that sticky.

Is the problem that xbmc.runscript is no valid action here? That would mean there is no way to put a script on a button? :/

Edit:
You edit again Smile I'll try it with obc1, i thought i can use any number that i want. I should read better, sorry!


Edit2: Works now. Thank your VERY mutch. Sorry for being a little dumb, its early in the morning here Smile
Reply
#10
cool Smile
Reply

Logout Mark Read Team Forum Stats Members Help
button -> execture script0