AppLauncher

AppLauncher

Source:

The WSH (Windows Script Host) CLI that launches apps according to the schema defined in a JSON file.

Requires

Methods

(static) launchAppsUsingSchema(schema, taskNameopt, optionsopt) → {void}

Source:

Backs up the directories.

Example
var apL = Wsh.AppLauncher; // Shorthand
var schema = {
  description: 'Example Schema WshAppLauncher',
  components: {
    binDir: 'D:\\MyApps',
    etcDir: 'D:\\MyConfs',
    wmLeftPath: null,
    wmRightPath: null
  },
  tasks: {
    'main:Claunch': {
      app: '${binDir}\\CLaunch\\ClAdmin.exe'
    },
    'main:AutoHotkey': {
      app: '${binDir}\\AutoHotkey\\AutoHotkeyU64.exe',
      args: ['${etcDir}\\MyHotKey.ahk'],
      runsAdmin: true
    },
    'main:FreeCommander': {
      app: '${binDir}\\FreeCommander\\FreeCommander.exe',
      args: ['/N', '/ini=${etcDir}\\FreeCommander.ini'],
      winStyle: 'nonActiveMin'
    },
    'main:mkTmpDir': {
      app: 'mkdir',
      args: ['R:\\tmp_#{yyyyMMdd}'],
      shell: true
    },
    'dev:cmdAdmin': {
      available: false,
      app: 'C:\\Windows\\System32\\cmd.exe',
      runsAdmin: true
    },
    'dev:Vim': {
      app: '${binDir}\\Vim\\gvim.exe',
      args: ['-N', '-u', '${etcDir}\\_vimrc', '-U', '${etcDir}\\_gvimrc']
    },
    'app:WinMerge': {
      app: '${binDir}\\WinMerge\\WinMergePortable.exe',
      args: ['${wmLeftPath}', '${wmRightPath}'],
      winStyle: 'activeMax'
    }
  }
};

apL.launchAppsUsingSchema(schema, 'main:*', {
  logger: 'info/console',
});
// Only process appLog:current. appLog:lastMonth is not processed because available is false.
Parameters:
Name Type Attributes Description
schema typeSchemaAppLauncher
taskName string <optional>

The task name to launch.

options object <optional>

Optional parameters.

Properties
Name Type Attributes Default Description
overwrites object <optional>

Ex. { anyVal1: 'myP@ss', anyVal2: 'p_w_d' }

logger string | Object <optional>

See options of Wsh.Logger.create

isDryRun boolean <optional>
false

No execute, returns the string of command.

Returns:
Type
void

(static) launchAppUsingLog(app, argsopt, optionsopt) → {void}

Source:

Launches the app.

Example
var apL = Wsh.AppLauncher; // Shorthand

apL.launchAppUsingLog('C:\\Windows\\System32\\net.exe', ['use'], {
  runsAdmin: true,
  winStyle: 'nonActive',
  logger: 'info/console' // See https://github.com/tuckn/WshLogger
});
Parameters:
Name Type Attributes Description
app string

The executable file path or the command of CMD.

args Array.<string> <optional>

The Array of arguments.

options object <optional>

Optional parameters.

Properties
Name Type Attributes Default Description
shell boolean <optional>
false

Wrap with CMD.EXE

winStyle number | string <optional>
'activeDef'

See Wsh.Constants.windowStyles.

runsAdmin boolean | undefined <optional>

true: as Admin, false: as User

isDryRun boolean <optional>
false

No execute, returns the string of command.

logger Logger | string | object <optional>

The Logger instance or create options. See Wsh.Logger.create.

transportsLog boolean <optional>
true

Outputs Wsh.Logger logs after connecting. See Wsh.Logger.transport.

Returns:
Type
void