Namespace LrShell

This namespace provides access to some operating-system shell functions (Finder in Mac OS, Windows Explorer in Windows). All paths must be provided in platform-specific syntax.

Summary

LrShell.openFilesInApp( files, appPath )
Opens one or more files in another application.
LrShell.openPathsViaCommandLine( files, appPath, extraArgs )
Opens one or more files via a command-line process.
Brings the Finder or Explorer to the foreground and highlights a file.

Functions

LrShell.openFilesInApp( files, appPath )
Opens one or more files in another application. For example:
 LrShell.openFilesInApp( { "/Users/example/myLightroomPlugin.lrplugin/Info.lua" }, "/Applications/TextEdit.app" ) 

NOTE: Windows has a maximum limit on the length of any command line it can process. In order to avoid this limit, Lightroom may have to split up large batches of files and make multiple calls to your command-line process. Windows documentation suggests that this limit is 8000 characters, but practical testing shows it to be much lower. Lightroom splits command lines that exceed 1500 characters (total length of command-line application name, extra arguments, and file names after escaping).

There appears to be no such limit in Mac OS, so this function always causes one and only one invocation of the command-line process.

First supported in version 1.3 of the Lightroom SDK.

Parameters

1. files
(array of strings) The paths to the files.
2. appPath
(string) The path to the external application.
LrShell.openPathsViaCommandLine( files, appPath, extraArgs )
Opens one or more files via a command-line process. For example:
 LrShell.openFilesInCommandLineProcess( { "/Users/example/myLightroomPlugin.lrplugin/Info.lua" }, "/usr/bin/edit", "-w" ) 

NOTE: Windows has a maximum limit on the length of any command line it can process. In order to avoid this limit, Lightroom may have to split up large batches of files and make multiple calls to your command-line process. Windows documentation suggests that this limit is 8000 characters, but practical testing shows it to be much lower. Lightroom splits command lines that exceed 1500 characters (total length of command-line application name, extra arguments, and file names after escaping).

There appears to be no such limit in Mac OS, so this function always causes one and only one invocation of the command-line process.

Note: Due to the implementation of fork() in Mac OS, multiple calls to this function are executed sequentially, even if run from separate tasks.

First supported in version 3.0 of the Lightroom SDK.

Parameters

1. files
(array of strings) The paths to the files.
2. appPath
(string) The path to the command-line application.
3. extraArgs
(optional, string) Extra arguments to be inserted between the process name and first file path.

Return value

(number) The return code from the process (typically 0 if no error). In Windows, the return code from the final run of the process if it was split.
LrShell.revealInShell( path )
Brings the Finder or Explorer to the foreground and highlights a file.

First supported in version 1.3 of the Lightroom SDK.

Parameters

1. path
(string) The path to the file.