1

I'm trying to make a very specialized "desktop environment" for some younger family members using Armory 3D which uses Haxe as a backend. It is basically a kiosked interface on top of Linux which only allows users to run specific programs and games. I have the button event linked to a function which is supposed to run a system app through bash. The problem is that I don't know how to call a bash (or any other kind of script/command/program) through Haxe.

I've tried searching around online for example code. I've seen people use -cmd <command> and Sys.command('<command>') but I'm not sure how to use these commands or if they require a certain setup to run.

This is going to be running on Linux 64-bit:

import Sys;
import iron.App;
import armory.system.Event;
import armory.trait.internal.CanvasScript;
...
            // Notify on button click
            Event.add("menu.Opera", runOpera);
        });
    }

    function runOpera() {
        Sys.command('bash opera');
    //  -cmd    'bash /usr/bin/opera';
    }
}

I want it to simply launch the Opera browser because my "desktop environment" will be using browsers quite frequently. It doesn't launch anything regardless of the method I try to use to launch applications. I've been getting this error when using Sys.command('<command>');:

27: characters 3-14 : Accessing this field requires a system platform (php,neko,cpp,etc.)

And when using -cmd '<command>'; I get:

28: characters 4-7 : Missing ;

I feel like I'm messing something up here but I have no prior knowledge of Haxe syntax.

[Edit] I'd like to point out that I've looked just about everywhere and cannot find anything reliable for launching system apps from Haxe.

Gama11
  • 31,714
  • 9
  • 78
  • 100
TriVoxel
  • 121
  • 3
  • 1
    "Accessing this field requires a system platform" - what platform are you targeting? – Gama11 May 19 '19 at 08:20
  • @Gama11 I'm trying to run bash on Linux. I'm not sure if that's what it's asking though. – TriVoxel May 19 '19 at 08:47
  • No, that's not quite what I mean.. from what I gathered, Armory3D supports a few different targets (labelled as "Runtime" in the editor) such as Krom, C++ and HashLink. I'm assuming you're using Krom, which uses Haxe's JavaScript target under the hood and thus doesn't have access to the `Sys` API? – Gama11 May 19 '19 at 08:51
  • @Gama11 Yeah. I'm currently using Krom but I also have access to C++ as well. Can I not pass through system commands this way? – TriVoxel May 19 '19 at 09:06
  • Hm.. I'm not sure if Krom has a way to do this already exposed somewhere, somebody more familiar with Kha might know. Could you just use the C++ or HashLink target (`Sys.command` should work there)? – Gama11 May 19 '19 at 13:06
  • @Gama11 Yes, both options are available in Armory for build. I'll let you know if it works. – TriVoxel May 20 '19 at 03:04
  • Did it work out? :) – Gama11 May 24 '19 at 13:03

0 Answers0