Method script.setup
Overload
Adds various features to this script task (running script): tray icon, exit on Ctrl+Alt+Delete
, etc.
public static void setup(bool trayIcon = false, bool sleepExit = false, bool lockExit = false, bool debug = false, UExcept exception = UExcept.Print, KKey exitKey = 0, KKey pauseKey = KKey.ScrollLock, string f_ = null)
Parameters
trayIcon (bool)
Add tray icon. See script.trayIcon. |
sleepExit (bool)
End this process when computer is going to sleep or hibernate. |
lockExit (bool)
End this process when the active desktop has been switched (PC locked, |
debug (bool)
Call DebugTraceListener.Setup with usePrint |
exception (UExcept)
What to do on unhandled exception (event System.AppDomain.UnhandledException). |
exitKey (KKey)
If not 0, the script task will end when this key pressed. Will call System.Environment.Exit.
Example: Recommended keys: media, volume, browser and applaunch keys. They work even when the process of the active window is admin (UAC) and this script isn't. In any case, the key does not work if somewhere used for a global hotkey, trigger, exitKey or pauseKey. Also the key does not work when at that time a modifier key is pressed by a script; it also can be dangerous because may generate a trigger or hotkey used by an app or OS. |
pauseKey (KKey)
Let script.pause pause/resume when this key pressed. Default:
|
f_ (string)
Caller info parameter. Don't use. Or use like |
Exceptions
InvalidOperationException
Already called. |
Remarks
Tip: in Options > Templates you can set default code for new scripts.
If your program was compiled not in LibreAutomate, call this function (maybe with zero arguments) if you want the program behave like if it was compiled with LibreAutomate (invariant culture, STAThread, unhandled exception action).
Does nothing if role editorExtension or if running in WPF preview mode.