Skip to content

Open App

Type: open-app  ·  Package: Desktop Activities v1.0.8  ·  Output: int

Launches an application or Windows process. It is usually the first step of a desktop automation: opening the program you are going to automate. It returns the PID (process identifier). Optionally it can wait for the process to finish before continuing, and then it returns its exit code.

It runs the program in path the way Windows does on a double-click (through the shell), optionally with arguments (args) and a working folder (workingDir; by default, the executable’s folder). That is why path can also be a bare name Windows knows how to find (notepad) or a document, which opens with its associated application.

Before and after launching, the activity checks what usually goes wrong in a robot session, so the error states the cause instead of showing up later as “window not found”:

  • Before: if path is a full path (C:\… or \\server\…) that does not exist, it fails right away. If the program came from the Internet (Mark of the Web), it leaves a warning in the log, because Windows may ask for a confirmation nobody gives.
  • While launching: Windows has up to timeout ms to open it. If it doesn’t return control (almost always a SmartScreen, UAC or “Open File - Security Warning” prompt waiting for a click), the activity fails naming the likely cause.
  • After: for 1 s it watches that the application does not close because of a startup error (missing DLL, damaged file, unhandled exception). If it exits with any other code, it only notes it in the log (launchers that hand over to another window do this).

By default the flow continues without waiting for the application to finish. With waitForExit = true the flow stops until the process finishes (useful for command-line tools).

After opening the app, a Win Attach usually follows to connect to its window.

ParameterTypeDefaultDescription
pathstring—Path of the executable or command to open. E.g. C:/ERP/erp.exe.
ParameterTypeDefaultDescription
argsstring—Command-line arguments.
workingDirstring—Working folder. Empty = the executable’s folder.
waitForExitboolfalseWait for the process to finish before continuing.
timeoutint30000Maximum ms for Windows to open the application. Empty = 30000, or the project’s UI timeout if longer. With waitForExit, it is also the maximum ms (from launch) for it to finish; empty or 0 = until it finishes, within the run’s maximum duration.

Returns an int:

  • With waitForExit = false (default): the PID of the launched process. Use it, for example, to terminate that instance with Kill Process.
  • With waitForExit = true: the process’s exit code (usually 0 = finished fine).
MessageCause and fix
The application '…' does not exist or this robot's Windows account cannot see it. …The path does not exist for the robot’s account (network drives and user folders can differ in a robot session). Use a UNC or local path valid for that account.
Windows blocked the application (SmartScreen): '…' came from the Internet (Mark of the Web) …The executable carries the Internet mark. Unblock it (Properties › Unblock, or Unblock-File in PowerShell) or install it from a trusted source.
Windows probably blocked the application (SmartScreen): '…' did not open within … s …SmartScreen is waiting for a confirmation. Same as above, or allow it in Windows Security.
'…' asks for administrator rights (UAC) and a robot cannot confirm that prompt. … / Windows is asking for administrator rights (UAC) to open '…' …The application requires elevation. Configure it not to, or use an account that already has those rights.
Windows did not open '…' within … s. …Windows did not finish opening it within timeout (a security prompt or the app is not responding). Check the machine with the robot’s account; if it is just slow, raise timeout.
This robot's Windows account is not allowed to run '…'. …Permissions are missing on the file or its folder.
'…' is not a valid application for this Windows (damaged file or wrong architecture).The executable is damaged or built for another architecture. Reinstall the application.
Windows has no application associated to open '…'.path is a document with no associated program. Set the executable and pass the document in args.
Opening '…' was cancelled: a Windows security prompt (SmartScreen or UAC) was rejected or closed.Someone (or a policy) rejected the security prompt.
'…' closed right after opening because of an error (code 0x…). …The application crashed on startup. Check it is installed correctly, its arguments and its working folder.
Could not open '…': …Another Windows error while launching; the trailing text explains it.
Could not start the process.Windows did not create a new process; this happens when opening a document or URL handled by an already open instance. If you need the PID, open the executable directly.
The process did not finish within … ms.With waitForExit, the process kept running past timeout. Raise it or leave it empty.
Open App path = "C:/ERP/erp.exe" → output: pid
Win Attach selector = (window "ERP — Login")
└─ body:
... automate the ERP ...

Run a command-line tool and check its result:

Open App path = "C:/Tools/export.exe" args = "/out \"" + folder + "\"" waitForExit = true → output: code
If condition = code != 0
└─ then:
Throw message = "The export finished with code " + code
  • Win Attach — connect to the opened app’s window.
  • Kill Process — terminate the application (by PID or by name).
  • Win Close — close the window when done.