Opening Designer from Vision Client

I want to create a button in a Vision client that, when pressed, opens up the designer for that project. The problem is that when I press the button, the code runs, but it doesn’t do anything. I’m not sure what I’m doing wrong here.

Here’s what I have so far:

system.util.execute(["C:\Users\User\AppData\Roaming\Inductive Automation\Designer Launcher\designerlauncher.exe", "-Dapp.home=C:\Users\User\ignition\clientlauncher-data -Dapplication=Ignition-Local-Gateway"])

I wrapped it in a try-catch to see if it was throwing an error, but I can confirm that it wasn’t.

Any ideas?

I don’t think that will ever throw an error outside of a python error if you use incorrect syntax on that funciton as it just tells the OS to try to run the command.

You could try using ProcessBuilder, or subprocess to get some output back. Here’s a snippet of how I do this with automated mysql backups and seeing if it was successful or receieved some error -

import subprocess
...
dumpcommand = "cd %s & .\\mysqldump --user=%s --password=%s --host=%s --port=%s --default-character-set=utf8 --single-transaction=TRUE --routines --events tab > %s"%(MYSQLDUMPPATH, DB_USER,DB_USER_PASSWORD,DB_HOST,DB_PORT,filepath)
p = subprocess.Popen(dumpcommand, stdout=subprocess.PIPE, shell=True)
result, err = p.communicate()
1 Like

Maybe system.util.execute works differently than I think it does?

Either way, using subprocess.Popen solved my issue. It works as I’d expect; no result/err needed.

import subprocess
...
dumpcommand = '"C:\Users\User\AppData\Roaming\Inductive Automation\Designer Launcher\designerlauncher.exe" -Dapp.home=C:\Users\User\ignition\clientlauncher-data -Dapplication=Ignition-Local-Gateway'
p = subprocess.Popen(dumpcommand, stdout=subprocess.PIPE, shell=True)
result, err = p.communicate()

Thanks @bkarabinchak.psi :grinning:

1 Like

Yea I was going to say that I think each argument/parameter is an additional item in the list for system.util.execute, so I think you could get it to work if it was like

system.util.execute(["C:\Users\User\AppData\Roaming\Inductive Automation\Designer Launcher\designerlauncher.exe", "-Dapp.home=C:\Users\User\ignition\clientlauncher-data", "-Dapplication=Ignition-Local-Gateway"])

One thing to note though is that running this in the client I think will only work if that user has opened up Designer and is your hardcoded username of User (I’m sure you obscured the real username for this forums sake).

Due to this part C:\Users\User\AppData\Roaming\Inductive Automation\Designer Launcher\designerlauncher.exe

1 Like