Download the Plugin SDK - supports C++, Delphi, Javascript, Python, C# and other .net

DOWNLOADS

HELP AND ASSISTANCE:

Latest Forum Posts

Addons for the Find and Run Robot Program

This page collects addons for the Find and Run Robot program that have been posted on our forum over the years. Click a link to go to the forum thread discussing the addon and download.

You are viewing a specific blog item. Click here to return to the main blog page.

FARRCloseSelProc -- FARR helper tool closes process matching selected filename

FARRCloseSelProc is a FARR helper tool that closes a process that matches the filename of the file that is selected in Explorer.

This is useful if you work on some code that you need to repeatedly compile, run and later close the process of before the next test run. But it can also be used to quickly close a process that you know the name of.

Setup:
1 paste the code into a text editor and save as FARRCloseSelProc.ahk and then compile it (you need http://ahkscript.org/ for that).
2 store the compiled FARRCloseSelProc.exe in some folder
3 create a FARR alias like this

alias name:
proc close
regex pattern:
^proc(?: |)(.*|)$
result box:
CloseSelProc $$1| C:\some\folder\FARRCloseSelProc.exe $$1 %LASTHWND%

To use it open Explorer and select a file you want to close a matching process for. For example select the file program.exe if you want to close the process program.exe . Press your FARR hotkey, type "proc" and when the alias shows press enter.
To use it by typing a process name press your FARR hotkey, type "proc program.exe" and press enter.

Note:
- The typed process name must match exactly. It must not have any spaces in the name.
- If there are multiple processes with that name only the first one detected by autohotkey will be closed.

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance force

x = %1%  ;hwnd parameter from FARR or exact name of a process from FARR
y = %2%  ;hwnd (if first param is exact name)

;FARRCloseSelProc -- a helper tool for FARR
;This tool is made to be run from a FARR alias.

if x =
 exitapp
if y ;filename mode
 splitpath, x, pname,,pext
else ;HWND mode
{
WinGetClass, xclass, ahk_id %x%
if xclass != CabinetWClass  ;exit if not Explorer win
 exitapp
WinActivate, ahk_id %x%,
ifwinNotactive, ahk_id %x%
 exitapp
clip := ClipBoardAll 
clipboard =
send ^c   ;copy
clipwait, 2
if errorlevel != 0
 exitapp
Loop, Parse, clipboard, `n, `r
{
p := a_loopfield
break
}
clipboard := clip ;restore
if InStr( FileExist(p), "D")
 exitapp
splitpath, p, pname,,pext
}

if (pext != "exe")
 exitapp

Process, close, %pname%
Loop, 10
{
Process, Exist, %pname%
if errorlevel = 0
break
sleep 100
}
Process, Exist, %pname%
if errorlevel = 0
 tooltip, Closed process %pname%
else
 tooltip, ERROR. Process %pname% still running.
sleep 2000
exitapp



Share on Facebook