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 in /var/mobile/Media/1ferver/lua/scripts/. If not found there, it treats the path as an absolute path.

  • Possible Responses

    {"code":0,"message":"脚本运行开始"}
    {"code":1,"message":"操作失败"}
    {"code":2,"message":"脚本有语法错误","detail":"specific error details"}
    {"code":3,"message":"已有脚本正在运行中"}
    {"code":4,"message":"无法读取文件"}
    {"code":8,"message":"参数错误"}
    {"code":9,"message":"脚本已损坏"}
    {"code":10,"message":"软件需要更新方能支持使用这个脚本"}
  • Python 3.x example (run the currently selected script, requires requests):

    # -*- coding: utf-8 -*-
    import requests

    resp = requests.post("http://192.168.31.72:46952/launch_script_file", timeout=30)

    if resp.status_code == 200:
    print(resp.json().get("message"))
    else:
    print(resp.status_code, resp.reason)
    print(resp.text)