Posts: 55
Threads: 25
Joined: Jan 2015
Hi
Is there a quick macro equivalent to this power shell command?
powershell -Command "Get-Process | Where-Object {$_.MainWindowTitle -eq 'my title name'} | stop-process"
I looked but I am a bit lost with how to do or if it's possible (I assume it is).
thanks.
Posts: 12,075
Threads: 141
Joined: Dec 2002
02-06-2023, 01:26 PM
(This post was last modified: 02-06-2023, 01:30 PM by Gintaras.)
;1 window
int w1 = win("*WordPad" "WordPadClass" "" 1)
if(w1) ShutDownProcess w1
;all windows
ARRAY(int) a
win "*WordPad" "WordPadClass" "" 1 "" a
for _i 0 a.len
,outw a[_i]
,ShutDownProcess a[_i]
Posts: 55
Threads: 25
Joined: Jan 2015
WordPadClass is equivalent to the MainWindowTitle then?
Posts: 55
Threads: 25
Joined: Jan 2015
thanks, but that doesn't seem to work when I enter the MainWindowTitle for the class, is the class and the title the same thing?
Posts: 12,075
Threads: 141
Joined: Dec 2002
Using just title can be dangerous. It could find and kill some other process. Therefore I also added class in the example. Also you can add program name.
int w1 = win("*name" "" "" 1) ;;dangerous
int w1 = win("*name" "class" "" 1) ;;ok
int w1 = win("*name" "" "program" 1) ;;ok
int w1 = win("*name" "class" "program" 1) ;;ok, this is the safest
Posts: 55
Threads: 25
Joined: Jan 2015
thanks. that will work great for my purposes.