File ExternalApp.lua
Functions
ExternalApp:browseForExe (params) | Browse for executable. |
ExternalApp:executeCommand (params, targets, outPipe, outHandling, noQuotes, expectedReturnCode) | execute external application via command-line. |
ExternalApp:getExe () | Get exe. |
ExternalApp:isUsable (noLog) | Determine if application is configured for use. |
ExternalApp:new (t) | Constructor for new instance. |
ExternalApp:newClass (t) | Constructor for extending class. |
ExternalApp:processExeChange (value) | If exe file changes, this needs to be called, so plugin does not have to be reloaded to start using the new setting. |
Functions
- ExternalApp:browseForExe (params)
-
Browse for executable. No default dir - oh well...
Parameters:
-
params
:
-
- ExternalApp:executeCommand (params, targets, outPipe, outHandling, noQuotes, expectedReturnCode)
-
execute external application via command-line.
Parameters:
-
params
: (string, default="") command-line parameters, if any. -
targets
: (table(array), default={}) list of command-line targets, usually paths. -
outPipe
: (outPipe, default=nil) optional output file (piped via '>'), if nil temp file will be used for output filename if warranted by out-handling. -
outHandling
: (string, default=nil) optional output handling, 'del' or 'get' are popular choices - see app-execute-command for details. -
noQuotes
: (boolean, default=false) optional in case quotes are problem (@8/Mar/2014, don't remember when they are). -
expectedReturnCode
: (number, default=0) optional return code expected.
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.
-
- ExternalApp:getExe ()
- Get exe.
- ExternalApp:isUsable (noLog)
-
Determine if application is configured for use.
Parameters:
-
noLog
:
Return values:
- status (boolean, required) true => seems usable; false => definitely not.
- message (string, optional) - returns qualifying string, may also return qualification when status is true, if exe is relative and hence can't be validated.
-
- ExternalApp:new (t)
-
Constructor for new instance.
Parameters:
-
t
: initialization table, with optional named elements:
- prefName: to get exe/app name/path from local/global prefs (takes precedence over all else, if set).
- winExeName: name of windows exe file in plugin folder (will be used if present in plugin, and not overridden by pref).
- macAppName: name of mac command-line executable file in plugin folder (will be used if present in plugin, and not overridden by pref).
- winDefaultExePath - absolute path to executable, by default, on Windows (only used if nothing better so far...).
- macDefaultAppPath - absolute path to executable, by default, on Mac (only used if nothing better so far...).
- *** deprecated - winPathedName: name of windows exe file expected to be in environment path (only used if nothing better so far...).
- *** deprecated - macPathedName: name of mac command-line executable expected to be registered ala Mac OS (only used if nothing better so far...).
*** pathed names are not recommended unless it's the only way, since there is no way to verify that they are actually configured in pathed env as specified.
Usage:
An error is thrown if at least something hasn't been found for executable.
Depends on initialized prefs.
-
- ExternalApp:newClass (t)
-
Constructor for extending class.
Parameters:
-
t
:
-
- ExternalApp:processExeChange (value)
-
If exe file changes, this needs to be called, so plugin does not have to be reloaded to start using the new setting.
Parameters:
-
value
: from pref or edited property, else nil or blank.
Usage:
global or local pref is not nor cleared by this method - that must be done externally to persist.
-