Command: StartHidden (run task without showing window)

StartHidden - Script command to start an external script/batch or application invisible.

Description:
This is handy for quickly running smaller things like batches and small commandline utilities in the background, without any window popping up.
You can even run "Notepad.exe" and it will not appear (needs killing by taskmanager or WM_CLOSE message then).

(Note: You can use the built-in @runmode:hide to do the same thing, if you are only launching one thing and/or want everything your button launches to be hidden. --Leo)

Parameters:

  • NOWAIT (optional, does not wait for the process to return, StartHidden will return !=0 in this case (success) and nothing went wrong launching the command)
  • CMDLINE (full commandline to run, dopus aliases and special paths will be resolved before the command is launched)

The command will set two global variables everytime it is used, so you can test for returncode and path resolval from somewhere else.
Theoretically at least, as within scripts, the global variable scope is not updated for the currently running instance.
You can alternatively rely on Command.Run().results.result, but remember it returns !=0 for success and is not the returncode of a process.
Command.Generic.StartHidden.CmdLine
Command.Generic.StartHidden.Result
Note, that there is a switch in the script config section to enable debug output in case you have trouble using it.

Usage:
This uses 3rd party tool CLAmp.exe in dopus home subfolder to skip a song in Winamp.

StartHidden CMDLINE=/home\tools\clamp.exe /next

Output (if enabled):

StartHidden():
     WAIT   : true
     CMDLINE: /home\tools\clamp.exe /next
     Running: D:\bin\file\dopus\tools\clamp.exe /next
     Ok, finished.

Installation:
To install the command, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
After that, "StartHidden" can be called from any button/menu or script extension.

Download: