How to add an entry in UI to run a custom script



  • Hi,

    At this time i didnt found an answer for this problem:

    Now that i can use Wake on Lan with the "ether-wake" command i want to add an entry for it in the moonlight section. My first guess was try to edit the gamelist.xml in the moonlight folder, but i guess the parser is too specific to let an sh-script through.

    Another solution could be a seperate Entry in the main menue if this is possible.

    I would be grateful for any suggestion


  • Banned

    @zemus you can help yourself with the readme for my randomizer script here, should give you most of the step : https://github.com/Voljega/scripts4recalbox/tree/master/Randomizer

    just adapt everything a little bit and replace the <command> tag content by your sh command



  • @voljega Thanks for the advice! I will try it out 🙂



  • @voljega

    But as far i can see, this will create a whole new systemchart. For one script only it seems a bit overkill. But i will see it later at home.


  • Banned

    @zemus you can't do it any other way for now, or you can but it's a bit more complicated

    You'd need to add a script command called by moonlight system and then check if you are launching your sh or another thing, and redirect to the standard moonlight command if needed or do your things if it is your wake up sh script

    Anyway you can do what you want really but at least these few steps will give you some hints on how to do it

    Actually for this more evolved thing if you are not afraid of python you can look at my randomizer script it does a little bit of that



  • @voljega

    After ive got through your readme, the answer was pretty obvious:

    add a new system in /recalbox/share_init/system/.emulationstation/es_systems.cfg like this:

    <system>
    <fullname>Scripts</fullname>
    <name>Scripts</name>
    <path>/recalbox/share/roms/scripts</path>
    <extension>.sh</extension>
    <command>%ROM%</command>
    <theme>Scripts</theme>
    <platform>Scripts</platform>
    <emulators/>
    </system>

    and put your .sh scripts in /recalbox/share/roms/scripts

    for example wakeonlan.sh:

    ether-wake -i wlan0 XX:XX:XX:XX:XX
    ether-wake -i eth0 XX:XX:XX:XX:XX

    works for me. Again thanks for your help 🙂


  • Staff
    Developer
    Team
    Global moderator
    Translator

    @zemus if you just add the .sh extension to the moonlight es_systems.cfg, wouldn’t it be enough? Maybe chmod'ing the script itself before?



  • @paradadf

    unfortunately that doesnt work.
    The original moonlight command interferes with it. There %ROM% is just a parameter.

    %ROM% as standalone works.


  • Banned

    @zemus yeah that's what I said that :
    "You'd need to add a script command called by moonlight system and then check if you are launching your sh or another thing, and redirect to the standard moonlight command if needed or do your things if it is your wake up sh script"

    if you want to integrate it to moonlight system, that is



  • @voljega

    Ah, now i know what you mean.
    Yeah sorry, it was late yesterday. I need more sleep.


  • Banned

    @zemus no prob 🙂



Want to support us ?

291
Online

80.5k
Users

21.6k
Topics

158.1k
Posts