You could do something like this: set(#countforprogram, "cmd.exe", "Global")
gettaskcount()
define gettaskcount {
set(#countforprogramfile, ".\\task-count-temp.dat", "Global")
shell("cmd.exe /C tasklist | find /I /C \"{#countforprogram}\" >\"{#countforprogramfile}\"")
set(#taskcount, $read file(#countforprogramfile), "Global")
shell("cmd.exe /C del \"{#countforprogramfile}\"")
}
if($comparison(#taskcount, ">=", 2)) {
then {
alert("Stopping. You have to many running.
Current running count is: {#taskcount}")
stop script
}
else {
alert("Running