#Run a shortcut from JS API

10 messages Β· Page 1 of 1 (latest)

hoary torrent
#

Hi πŸ‘‹ I would love to know how can I from the JS side invoke an app run with arguments.

async function enterServer(serverIP) {
  const serverPath = "path/to/server.exe";
  await Command.run(`${serverPath} -connect=${serverIP}`);
}

Basically I need to transform that snippet in a working code for Tauri πŸ€”

rich stirrup
hoary torrent
rich stirrup
#

yeah, basically

hoary torrent
#

I'll test it out tomorrow, thank you πŸ˜„

hoary torrent
#

@rich stirrup I got the following error:
Uncaught (in promise) program not allowed on the configured shell scope: serverPath

I have this on my tauri.config.js:

    "allowlist": {
      "all": true,
      "shell": {
        "all": true,
        "execute": true,
        "sidecar": true,
        "open": true,
        "scope": [
          {
            "name": "serverPath",
            "cmd": "serverPath",
            "args": ["-connect", { "validator": "\\S+" }]
          },
        ]
      }
    },
rich stirrup
#

"serverPath" must be an actual path, or the name of the binary

hoary torrent
#

Hmm okok, but in the frontend the user specifies the folder path of the executable πŸ€”

rich stirrup
#

that will be a bit more tricky then