Magoo, Web Bot Operator

A GTK application in python that allows you to write a python script that will pilot the ISS-Sim webgl simulator.

I wanted to create a bot to drive the SpaceX ISS-Sim webgl simulator. Magoo allows you to do just that.

Magoo is written in python and uses the GTK tookit to create a way to write python scripts that can interact with the page. Because magoo uses the webgtk element, the pages javascript is exposable to the python backend. Each page has a designated tab and bot assigned to it. The page object is setup to expose specific javascript variables and function calls that will execute within the web page. These exposed variables and functions can be run from within a user supplied python script, the bot_script. I originally tried to do this with a browser plugin but found the security boundry of a browser plugin only allows access to the DOM and not the javascript running in the page.

Here is an example of the full application with the script edit window and variable window.

Clicking “Edit Bot” button will expose the window on the left, which shows where the user may place their custom python script. The “Run Bot” Button will execute the bot in its own thread and run until the bot script exits, or the user clicks ‘Stop Bot’. Clicking ‘Exposed Variables’ will display the window with the variables are updated once a second and displayed in the seperate variable window. These are the exposed variables usable by the users python script. This update interval can be adjusted in the BrowserTab's object variable self.periodic_bot_value_update_time

At any time the user may update the script in the script editor window and click ‘run bot’. This will reload the bot with the new script and run it against the currently displayed web page.

Currently the BrowserTab object contains to dictionaries that expose the variables and functions to use in the script.

  • Here is an example of the BrowserTab objects exposed_values dictionary
    #  Declare this pages exposed information
    self.exposed_values = {
        "rateRotationX": [JavascriptType.DOUBLE, "rateRotationX", 0, "Pitch Speed"],
        "rateRotationY": [JavascriptType.DOUBLE, "rateRotationY", 0, "Yaw Speed"],
        "rateRotationZ": [JavascriptType.DOUBLE, "rateRotationZ", 0, "Roll Speed"]
    }
  • Access them in the script like this
    if self.browser_window.get_value("fixedRotationX") > 0 and self.browser_window.get_value("rateRotationX") < (
            min(abs(self.browser_window.get_value("fixedRotationX")), 1) * 2):
  • And now some of the BrowserTab objects ‘exposed_commands’ dictionary
    #  Declare this pages exposed commands
    self.exposed_commands = {
        "rollLeft": "rollLeft()",
        "rollRight": "rollRight()",
        "pitchDown": "pitchDown()"
    }
  • The exposed commands can be used in the script like this.
    self.browser_window.execute_command("rollRight")

Secret is, the version of the script I have in this application does not dock with the space station without drifiting into space. Im working on it. My main accomplishment was to allow for a workflow that does not require starting and stopping the application while writing the bot.

Additions will include:

  • Support for other pages, MultiUser Sketchpad.
  • Realtime creation of variables exposures
  • Realtime creation of function exposures.

The next tab to be added will be a drawing bot for MultiUser Sketchpad MultiuserSketchpad on glitch.