Skip to main content

Run a Script File

  • Description

    POST /launch_script_file HTTP/1.1

    {"filename": "script file name"}
  • Notes
    filename is optional. If omitted, the currently selected script file will be used.
    It first looks under /var/mobile/Media/1ferver/lua/scripts/; if not found there, it will try the absolute path.

  • Possible Responses

    {"code":0,"message":"Script started"}
    {"code":1,"message":"Operation failed"}
    {"code":2,"message":"Syntax error in script","detail":"specific error details"}
    {"code":3,"message":"A script is already running"}
    {"code":4,"message":"Unable to read file"}
    {"code":8,"message":"Invalid parameters"}
    {"code":9,"message":"Script is corrupted"}
    {"code":10,"message":"Software update required to support this script"}
  • Desktop example (run currently selected script, Python 3.x):

    # -*- coding: utf-8 -*-
    import http.client
    import json

    conn = http.client.HTTPConnection("192.168.31.72:46952") # device address and port
    conn.request("POST", "/launch_script_file", ''.encode('utf-8')) # explicitly send empty UTF-8 bytes

    response = conn.getresponse()

    if response.status == 200:
    ret = json.loads(response.read().decode('utf-8')) # explicitly decode as UTF-8
    print(ret['message'])
    else:
    print(response.status, response.reason)
    print(response.read().decode('utf-8')) # explicitly decode as UTF-8

    conn.close()