FolderItem.Open

From Xojo Documentation

Method

FolderItem.Open(parameters as String = "" [,activate as Boolean])

New in 2019r2.1

Supported for all project types and targets.

If the FolderItem is an app, the app is opened. If the FolderItem is a document, the document is opened using its default app.

Notes

parameters is the app's parameters to be passed to the app being open. The optional parameter activate specifies whether the app should be opened frontmost or behind other apps. The default value is True (foreground). If you specify False, the app will attempt to open in the background, but this may not work with certain apps.

Open is not available in console applications.

MacOS does not open multiple copies of apps. If you need to open 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 open
Var sh As New Shell
sh.Execute("open -n " + myApp.ShellPath)

Sample Code

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

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

See Also

Shell