WinExeCommander - Simplify the calling of functions when windows/processes are created, devices are connected.

Post your working scripts, libraries and tools.
XMCQCX
Posts: 241
Joined: 14 Oct 2020, 23:44

WinExeCommander - Simplify the calling of functions when windows/processes are created, devices are connected.

18 Apr 2024, 10:13

WinExeCommander
Script to simplify the calling of functions when windows/processes are created/terminated, devices are connected/disconnected.

Features
  • Execute fonctions upon:
    - Process creation/termination.
    - Window creation/termination, activated/deactivated.
    - Device connection/disconnection.
  • Select from various criteria, including wintitle, winclass, process name, process path, active/maximize/hidden window and additional parameters.
  • Enable or disable the monitoring of individual events using the tray menu, user interface (GUI), or method call.
  • Save profiles and load them via the tray menu, user interface (GUI), or method call.
  • Themes customization
For the latest version of this script and the instruction, head over to the GitHub page.
:arrow: Download on GitHub

For example:

When the Calculator app is opened, set the window to be always on top.

Code: Select all

Calculator_AlwaysOnTop_Created(mEvent) {
    
    if WinExist('ahk_id ' mEvent['id'])
        WinSetAlwaysOnTop(1, 'ahk_id ' mEvent['id'])
    else
        WinExeCmd.MsgBox('Calculator does not exist.', 'WinExeCommander', 'iconx')    
}
When the "mspaint.exe" process is created, change its priority level to "High".

Code: Select all

MSPaint_ProcessSetPriority_Created(mEvent) {

    if ProcessExist(mEvent['pid'])
        ProcessSetPriority('High', mEvent['pid'])
    else
        WinExeCmd.MsgBox('MSPaint does not exist.', 'WinExeCommander', 'iconx')
}
Image
Image
cumulonimbus
Posts: 4
Joined: 19 Aug 2023, 13:37

Re: WinExeCommander - Simplify the calling of functions when windows/processes are created, devices are connected.

18 Apr 2024, 20:33

Thanks for sharing. Can this tool be used as a library rather than a tool with an interface? I would like to use it like OnMessage() registers events, e.g.

OnCommander { exe: 'Notepad.exe', event: 'maximize', call: (*) => MsgBox('Notepad maximize') }
XMCQCX
Posts: 241
Joined: 14 Oct 2020, 23:44

Re: WinExeCommander - Simplify the calling of functions when windows/processes are created, devices are connected.

20 Apr 2024, 10:38

cumulonimbus wrote:
18 Apr 2024, 20:33
Can this tool be used as a library rather than a tool with an interface?
No, events must be created through the interface. They could also be created via the JSON settings file, but it's not recommended since it needs to be formatted properly; otherwise, it will cause an error.

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: songdg and 20 guests