title: secureCRT VBS using WaitForStrings() and Switch Case
body: <p>This is a script to simulate answers from a machine, my problem is that "WaitForStrings" dosent differentiate between "open" and "open1" or "close" and "close1", he always answers to "open" and "close"</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>firstopen=true
  while(true)
   strResult = crt.Screen.WaitForStrings("open1","close1","open","close","SCAN")
   Select Case strResult
    Case 1
     crt.Sleep 500
     crt.Screen.Send("open1_ok") &amp; chr(13)
    Case 2
     crt.Sleep 500
     crt.Screen.Send("close1_ok") &amp; chr(13)
  
    Case 3
     If firstopen=true then
      crt.Sleep 500
      crt.Screen.Send("open_ok") &amp; chr(13) 
      firstopen=false
     else
      crt.Sleep 500
      crt.Screen.Send("ok") &amp; chr(13)
      firstopen=true
     end if 
    Case 4
    crt.Sleep 500
    crt.Screen.Send("ready") &amp; chr(13)
  
    Case 5
    crt.Sleep 500
    crt.Screen.Send("CCD_PASS") &amp; chr(13)
    
    Case Else
    crt.Screen.Dialog "We didn't find what we were looking for"
   
   End Select
  wend</code></pre>
  </div>
  </div>
  </p>