FolderItem.Launch

From Xojo Documentation

Method

FolderItem.Launch(Parameters as String = "" [,Activate as Boolean])

Supported for all project types and targets.

If the FolderItem is an application, the application is launched. If the FolderItem is a document, the document is opened and the application is launched if necessary.

Notes

Parameters is the application’s parameters to be passed to the launched application (Windows and Linux). The optional parameter Activate specifies whether the application should be launched in the foreground or background. The default value is True (Foreground). If you specify False, the app will be attempted to launch in the background, but this may not work with certain applications.

Launch is not available in console applications.

MacOS does not launch multiple copies of apps. If you need to launch multiple copies of an app, you should use a Shell with the "open -n Appname.app" terminal command like this:

// myApp is a FolderItem pointing to the app you want to launch
Var sh As New Shell
sh.Execute("open -n " + myApp.ShellPath)

Example

This example displays a PDF file in the built-in PDF viewer:

Var pdfFile As FolderItem
pdfFile = FolderItem.ShowOpenFileDialog("")
If pdfFile <> Nil Then
pdfFile.Launch
End If

See Also

Shell