Handler does not work within an IF statement ...


I have a handler that works perfectly as a single statement, but not when embedded in an IF statement. Here is the handler:

on ForceQuitTheApp(appName)
		set thePid to (do shell script "ps ax | grep " & (quoted form of appName) & " | grep -v grep | awk '{print $1}'")
		if thePid is not "" then do shell script ("kill -9 " & thePid)
	end try
end ForceQuitTheApp

BTW what does the variable «thePid» stand for ? I copied that from another thread without really understanding what it meant …



(P)rocess (ID)entification number

Got it … I used «my» in front of my handler’s name, and everything is working. Should do more scripting to keep all those rules in mind.

But still, in the script, what does the variable «thePid» stand for ?

see post #2 and here