EXE Apps: Making system calls

When we came up with our implementation of EXE files, we realized it would be great if there was a mechanism for making system calls. Let’s see how this is done.

AppStudio 5 can make standalone installers for your apps, so they run on any Windows 7 (or later) system. It creates a wrapper for your AppStudio app which runs an Internet Explorer window. Your app runs in that window. All of the visual interface of IE is turned off: all you see is your app running in the wrapper. The wrapper itself is written in Python, an extremely flexible and easy to use language.

We can send commands from AppStudio apps to the wrapper, which executes them and returns the results.

Let’s look at a couple of examples:

  1. Exit the EXE app.

    You can exit an EXE app by clicking on the Exit button at the top right of the app’s window. However, if you have a frameless app, there is no Exit button.

    Use this command to exit the app:


    The EXE.pythonEval function sends a string to the Python wrapper to be executed, in this case "sys.exit(0)". The Python wrapper includes several Python libraries: sys is the name of one of them.

    You can see all the functions in the sys library in the official Python documentation.

  2. Start Word from your app

    To do this, we need to execute from the Windows command line. We can do this using the os.system() function from the Python OS library. Here’s how it looks:

    EXE.pythonEval("os.system('start winword')")

    There are three levels to this statement.

    • EXE.pythonEval sends its argument "os.system('start winword')" to the wrapper.
    • The wrapper sends the argument 'start winword' to the os.system function in the os library.
    • The os.system function executes start winword as if it was typed in the command line.

    You can see all the functions in the os library in the official Python documentation.

  3. Other Libraries
    The following Python libraries are included in the wrapper:

    • json: JSON encoder and decoder
    • os: Miscellaneous operating system interfaces
    • sys: System-specific parameters and functions
    • wx: wxWidgets C++ class library – UI components