title: How do I determine a variable's data type? How to convert to string?
body: <p>I have two questions...</p>
  
  <p>Here is a really simple example script which causes an error:</p>
  
  <p><em>System Events got an error: Can’t make item 1 of every application process whose visible = true into type string.</em></p>
  
  <pre><code>tell application "System Events"
     repeat with appProc in (every application process whose visible is true)
         display dialog appProc
     end repeat
  end tell
  </code></pre>
  
  <h1>1- How do I determine the data type of a variable?</h1>
  
  <p>This would be helpful for future reference so I can figure out what kind of data type I am dealing with</p>
  
  <h1>2- How do I convert the above data type to a string so it displays with display dialog?</h1>
  
  <p>I tried adding:</p>
  
  <pre><code>appProc as string
  </code></pre>
  
  <p>but then I get another error that says:</p>
  
  <p><em>Can’t make «class pcap» "myapplication" of application "System Events" into type string.</em></p>