ConsoleLaunch: ConsoleExecuteMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

ConsoleExecuteMBS(path as folderitem, arguments() as string, environment() as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method Shell MBS Util Plugin 13.0 ✅ Yes ❌ No ✅ Yes ❌ No Desktop, Console & Web
Executes a new application.

Use WindowsShellExecuteMBS on Windows.

Launch GUI tools on Mac OS X using /bin/open.
Returned value is the PID of the new process.
If the execution fails you still get a PID, but this process is terminated in a few milliseconds.

arguments must have at least one member.

See also WindowsProcessMBS and WindowsShellExecuteMBS (Windows only), NSTask (Mac only) and ShellMBS (cross platform).

See also:

Some examples using this global method:

ConsoleExecuteMBS(path as string, arguments() as string, environment() as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method Shell MBS Util Plugin 7.7 ✅ Yes ❌ No ✅ Yes ❌ No Desktop, Console & Web
Executes a new application.
Example
// launch an app using open

const sShellPath="/usr/bin/open"

dim a(1) as string
dim e(-1) as string

a(0)="open" // must be the application name
a(1)="/Applications/TextEdit.app" // first parameter

print str(ConsoleExecuteMBS(sShellPath,a,e))

// Launch app binary directly:

dim aa(1) as string
dim ee(-1) as string

dim f as FolderItem

f=GetFolderItem("test.app").Child("Contents").Child("MacOS").Child("test")

aa(0)=f.ShellPath

print str(ConsoleExecuteMBS(f.ShellPath,aa,ee))

Use WindowsShellExecuteMBS on Windows.

Launch GUI tools on Mac OS X using /bin/open.
Returned value is the PID of the new process.
If the execution fails you still get a PID, but this process is terminated in a few milliseconds.

arguments must have at least one member.

See also WindowsProcessMBS, WindowsShellExecuteAsAdminMBS and WindowsShellExecuteMBS (Windows only), NSTask (Mac only) and ShellMBS (cross platform).

See also:

Some examples using this global method:

Blog Entries

The items on this page are in the following plugins: MBS Util Plugin.


💬 Ask a question or report a problem