How to check for a generic single process launched by a certain file

When I launch or stop headless VMs on Fusion I need to check if they are running or not. To determine the single VM I need to get the vmx file that started it behind the vmware-vmx process. This is what I came up with

do shell script "ps ax | grep " & theVM & "[.vmx] | sed -e \"s/.*/'&'/\" | xargs basename"

Any better more applescript-y alternatives?


I think that is the best if not the only way to do it. It seems to me that you can’t use System Events to get at unix processes. It is also the way AppleScripters use in order to get at some process.