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?