bug.n icon indicating copy to clipboard operation
bug.n copied to clipboard

Create rule for process

Open Babbie opened this issue 6 years ago • 1 comments

I want all windows spawned by a specific process to be moved to a specific view. Is this currently supported? If so, I cannot find how.

Babbie avatar Aug 07 '18 17:08 Babbie

This is currently not possible. If you are running the script and like to code a bit, you may write something like the following:

Window_isOwnedbyProcess(wndId) {
  ;; Only one function argument is allowed: the id of the window, which should be processed.
  ;; This will be passed by `Manager_applyRules` via `%rule3%(wndId)`.
  ;; This function should return `True` or `False`.
  pName := "notepad.exe"
  pPath := "C:\Windows\System32\notepad.exe"
  WinGet, wndPName, ProcessName, ahk_id %wndId%
  WinGet, wndPPath, ProcessPath, ahk_id %wndId%
  r := (pName = wndPName || pPath = wndPPath)
  Return, r
}

I did not test this function. (I am currently working on a chromebook.) You may use ProcessName or ProcessPath, both or even PID. Set the values for pName and pPath appropriately.

Than set a rule in Config.ini like the following: Config_rule=.*;.*;Window_isOwnedbyProcess;1;0;<view>;0;0;0; ... with <view> set to a value as described in doc/Configuring_rules.md.

– But perhaps using the window title and class may be sufficent to identify the windows in question.

joten avatar Aug 14 '18 20:08 joten