title: How to output process id in vbs / why is this not working
body: <p>I am  an absolute noob in vbs but so far, i have modified a script, which scans all the running processes and if they fall under the 'application'  then it's name is outputted to a csv file.</p>
  
  <pre><code>Set Word = CreateObject("Word.Application")
  Dim fso
  Set fso = WScript.CreateObject("Scripting.Filesystemobject")
  Set f = fso.CreateTextFile("output.csv", 2)
  Set Tasks = Word.Tasks
  For Each obj in Tasks
     PID = obj.ProcessID
     If obj.Visible Then f.Writeline obj.Name &amp; "," &amp; PID
  Next
  Word.Quit
  </code></pre>
  
  <p>My aim is to, get a list of all application, and after reading the name decide which to terminate and kill it using it's process id (which you get from the csv file).</p>
  
  <p>It is able to correctly output the name however if i try to output processID i keep getting this:</p>
  
  <blockquote>
    <p>Object doesn't support this property or method:<br>
     'obj.ProcessID'<br>
      Code : 800A02B6</p>
  </blockquote>
  
  <p>There is not much help online, most examples i see use x.processID  to find processID.</p>
  
  <p>Can someone tell me why it does not work in the above code.</p>
  
  <p>Thanks.</p>