File OperatingSystem.lua
Functions
OperatingSystem:execute (command, expectedReturnCode) | Executes the specified command via the OS command shell. |
OperatingSystem:executeCommand (exeFile, _params, _targets, outPipe, outHandling, noQuotes, expectedReturnCode) | Executes the specified command via the windows or mac command shell. |
OperatingSystem:getShellName () | Return OS shell name (e.g. |
OperatingSystem:makeFileLink (linkPath, folderPath) | Pure abstract function (implemented by derived class). |
OperatingSystem:makeFolderLink (linkPath, folderPath) | Pure abstract function (implemented by derived class). |
OperatingSystem:new (t) | Constructor for new instance. |
OperatingSystem:newClass (t) | Constructor for extending class. |
OperatingSystem:openFileInDefaultApp (file) | Opens one file in its O.S.-registered default app. |
OperatingSystem:sendUnmodifiedKeys (text) | Send unmodified keys (pure abstract method). |
Functions
- OperatingSystem:execute (command, expectedReturnCode)
-
Executes the specified command via the OS command shell.
Parameters:
-
command
: Complete command string. -
expectedReturnCode
:
Usage:
Not usually called directly, but available for cutting out the middle man for testing...
Command is a string generally consisting of a target app, parameters, and object files.
Must be called from asynchronous task.
Return values:
- boolean: true iff command successfully executed, as indicated by exit-code = 0.
- command string executed if successful, else error message.
-
- OperatingSystem:executeCommand (exeFile, _params, _targets, outPipe, outHandling, noQuotes, expectedReturnCode)
-
Executes the specified command via the windows or mac command shell.
Parameters:
-
exeFile
: name or path of executable. -
_params
: command parameter string, e.g. '-p -o "/Programs for lunch"' (without the apostrophes). -
_targets
: array of command targets, usually one or more paths. -
outPipe
: -
outHandling
: -
noQuotes
: (boolean, default=false) mostly used on windows to suppress quotes around exe file and whole kitt-n-kaboodle, for those cases when command won't tolerate them, e.g. ftype Adobe.AdobeLightroom. -
expectedReturnCode
:
Usage:
Normally called indirectly by way of app object - see it for more info.
Return values:
- status (boolean): true iff successful.
- command-or-error-message(string): command if success, error otherwise.
- content (string): content of output file, if out-handling > 0.
-
- OperatingSystem:getShellName ()
- Return OS shell name (e.g. Explorer or Finder)
- OperatingSystem:makeFileLink (linkPath, folderPath)
-
Pure abstract function (implemented by derived class).
Parameters:
-
linkPath
: -
folderPath
:
-
- OperatingSystem:makeFolderLink (linkPath, folderPath)
-
Pure abstract function (implemented by derived class).
Parameters:
-
linkPath
: -
folderPath
:
-
- OperatingSystem:new (t)
-
Constructor for new instance.
Parameters:
-
t
:
-
- OperatingSystem:newClass (t)
-
Constructor for extending class.
Parameters:
-
t
:
-
- OperatingSystem:openFileInDefaultApp (file)
-
Opens one file in its O.S.-registered default app.
Parameters:
-
file
:
Usage:
Non-blocking - nothing returned.
Good choice for opening local help files, since lr-http-open-url-in-browser does not work properly on Mac in that case.
Not called directly - see operating system parent class for more info
-
- OperatingSystem:sendUnmodifiedKeys (text)
-
Send unmodified keys (pure abstract method).
Parameters:
-
text
:
-