Detect if process (Notepad.exe) is running and kill it

Share your macros, knowledge, solutions, services, ...
Post Reply
Petr
Posts: 106
Joined: Tue Oct 18, 2016 1:12 pm

Detect if process (Notepad.exe) is running and kill it

Post by Petr » Fri Nov 25, 2016 12:08 pm

This macro detects if process (Notepad in this example) is running and kills it on user confirmation.

Code: Select all

<#> Start of the macro
<cmds>

<#> Find notepad.exe in running processech
<if_process>(notepad.exe,EXIST)

   <#> Ask for killing if running
   <msg>(-100,-100,"Notepad.exe is running. Do you want to kill it?","Message",2)

   <#> Is last answer YES?
   <if_str>("_vMsgButton==YES")

      <#> kill process  
      <process_kill>(notepad.exe)

   <endif>

<else>

   <#> No process notepad.exe found, show message
   <msg>(-100,-100,"Notepad.exe is not running.","Message",1)

<endif>

<#> End of the macro

Post Reply