Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
find and kill process by window title
#1
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.
#2
Code:
Copy      Help
;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]
#3
WordPadClass  is equivalent to the MainWindowTitle then?
#4
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?
#5
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
#6
thanks. that will work great for my purposes.


Forum Jump:


Users browsing this thread: 1 Guest(s)