Skip to content

API UO Launch en

Codex edited this page Oct 3, 2026 · 1 revision

UO.Launch

Русский · English · Українська · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

UO.Exec · UO.Launch · UO.CallSub · UO.FunRunning · UO.SubExists

ClassicUO • Runtime API

Asks the operating system to open a local program or document, such as a loot report or external utility. It does not run a Basic script; use StartScript for that.

Exact syntax

UO.Launch(file:Any) -> Integer
UO.Launch(file:Any, parameters:Any) -> Integer
UO.Launch(file:Any, parameters:Any, workingDirectory:Any) -> Integer
UO.Launch(file:Any, parameters:Any, workingDirectory:Any, hidden:Any) -> Integer

Parameters

  • file — Required program/document path or name, converted to text and trimmed. Empty input returns 0 with an error message. Prefer a full path to select the exact program; do not add surrounding quotes to file itself.
  • parameters — Optional external argument string, empty by default. These are process arguments, not Basic parameters. Quote paths containing spaces inside this string, for example using Chr(34).
  • workingDirectory — Optional process working folder. Omitted or empty uses the current script's directory. If that directory is unavailable to the runtime, the bridge uses the client's process working directory. This is not necessarily the game or client EXE folder.
  • hidden — Optional Boolean, default False. True disables the OS shell and requests no console window; supply an executable. False allows document associations. A GUI application may still create its own window.

Returns

Integer: 1 (True) if Process.Start returns a process object; otherwise 0 (False). Comparisons with 1 or True work. It is not a PID, exit code or completion acknowledgement. Exceptions report an error and return 0. Opening a document in an existing application may return no new process, so 0 does not always prove that the document failed to open.

Behavior

  • Only the listed one-to-four-argument overloads are supported, in order. To set hidden while keeping the default directory, pass an empty third argument. Text conversions do not check file existence in advance.
  • The default directory comes from the currently executing script. With hidden=True, a relative program path is first checked against workingDirectory. OS name lookup and document associations depend on the system; a full path avoids ambiguity. Missing programs or directories can fail to launch.
  • The process runs independently. Launch neither waits for completion, captures stdout/stderr nor terminates the program when the script stops. hidden is a launch request, not a guarantee that every window remains invisible. The Process object is disposed after the request; the launched program keeps running.

Internal functions: from call to result

These are client implementation stages, not additional Basic commands. Example helper procedures are defined in full.

1. CompactLaunch

Only the listed one-to-four-argument overloads are supported, in order. To set hidden while keeping the default directory, pass an empty third argument. Text conversions do not check file existence in advance.

The default directory comes from the currently executing script. With hidden=True, a relative program path is first checked against workingDirectory. OS name lookup and document associations depend on the system; a full path avoids ambiguity. Missing programs or directories can fail to launch.

Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApiUO.cs; function CompactLaunch.

2. Launch / Process.Start

The process runs independently. Launch neither waits for completion, captures stdout/stderr nor terminates the program when the script stops. hidden is a launch request, not a guarantee that every window remains invisible. The Process object is disposed after the request; the launched program keeps running.

Integer: 1 (True) if Process.Start returns a process object; otherwise 0 (False). Comparisons with 1 or True work. It is not a PID, exit code or completion acknowledgement. Exceptions report an error and return 0. Opening a document in an existing application may return no new process, so 0 does not always prove that the document failed to open.

Project source: src/ClassicUO.Client/Game/Managers/ClassicUOInjectionApiBridge.cs; function Launch / Process.Start.

These are client implementation stages, not additional Basic commands. Example helper procedures are defined in full.

Examples

Open an existing loot report

# Open an existing loot report
#
# Asks the operating system to open a local program or document, such as a loot report or
# external utility. It does not run a Basic script; use StartScript for that.
#
# Integer: 1 (True) if Process.Start returns a process object; otherwise 0 (False). Comparisons
# with 1 or True work. It is not a PID, exit code or completion acknowledgement. Exceptions
# report an error and return 0. Opening a document in an existing application may return no new
# process, so 0 does not always prove that the document failed to open.

SUB Main()
    # Place an existing loot-report.txt beside the script. The OS uses the .txt association. Main
    # returns the launch request result, not the file contents or proof that the report was read.

    Dim started = UO.Launch("loot-report.txt")
    Return started
END SUB

Parameter and execution notes:

  • Place an existing loot-report.txt beside the script. The OS uses the .txt association. Main returns the launch request result, not the file contents or proof that the report was read.

Pass a spaced path to an editor

# Pass a spaced path to an editor
#
# Asks the operating system to open a local program or document, such as a loot report or
# external utility. It does not run a Basic script; use StartScript for that.
#
# Integer: 1 (True) if Process.Start returns a process object; otherwise 0 (False). Comparisons
# with 1 or True work. It is not a PID, exit code or completion acknowledgement. Exceptions
# report an error and return 0. Opening a document in an existing application may return no new
# process, so 0 does not always prove that the document failed to open.

SUB Main()
    # The folder and report must exist; substitute your own paths. Chr(34) quotes the report's full
    # path inside arguments. notepad.exe must be available to the system. False permits the ordinary
    # editor window.

    Dim report = "C:\UO Scripts\loot report.txt"
    Dim arguments = Chr(34) & report & Chr(34)
    Return UO.Launch("notepad.exe", arguments, "C:\UO Scripts", False)
END SUB

Parameter and execution notes:

  • The folder and report must exist; substitute your own paths. Chr(34) quotes the report's full path inside arguments. notepad.exe must be available to the system. False permits the ordinary editor window.

List local logs without a console window

# List local logs without a console window
#
# Asks the operating system to open a local program or document, such as a loot report or
# external utility. It does not run a Basic script; use StartScript for that.
#
# Integer: 1 (True) if Process.Start returns a process object; otherwise 0 (False). Comparisons
# with 1 or True work. It is not a PID, exit code or completion acknowledgement. Exceptions
# report an error and return 0. Opening a document in an existing application may return no new
# process, so 0 does not always prove that the document failed to open.

SUB Main()
    # Windows example using cmd.exe: creates or overwrites log-files.txt beside the script, listing
    # *.log files. Empty argument three selects the script folder; True hides the console. True from
    # Main only confirms a process launch: the file may not be ready, and missing *.log files or
    # utility errors do not change the earlier Launch result.

    Dim started = UO.Launch("cmd.exe", "/d /c dir /b *.log > log-files.txt", "", True)
    If started = 0 Then
        Return False
    End If
    Return True
END SUB

Parameter and execution notes:

  • Windows example using cmd.exe: creates or overwrites log-files.txt beside the script, listing *.log files. Empty argument three selects the script folder; True hides the console. True from Main only confirms a process launch: the file may not be ready, and missing *.log files or utility errors do not change the earlier Launch result.

Clone this wiki locally