title: Launching UFT ( QTP ) Tests remotely through a batch file.
body: <p>I have created a bunch of UFT 12 (ex QTP) tests and I have also created a batch file in order to run theses tests.</p>
  
  <p>When I run the batch file in local the tests are running fine.</p>
  
  <p>Here is the script I use : </p>
  
  <pre><code> Set qtpApp = CreateObject("QuickTest.Application")
   Set fsObj = CreateObject("Scripting.FileSystemObject")
   Set qtpResObj = CreateObject ("QuickTest.RunResultsOptions")
  
  qtpApp.Launch
  qtpApp.Visible= true
  
  sfolderPath = "C:\QA\ManagerForOracleDB"
  Set mainFolderObj = fsObj.GetFolder (sfolderPath)
  Set testSubFolders = mainFolderObj.SubFolders
  sPath = "C:\&amp;formatDate&amp;\"
  
  For each folderobj in testSubFolders
  
  chkfolderobj = folderObj.Path &amp; "\Action0"
  
  if ( fsObj.FolderExists(chkfolderobj)) then 'The Folder is a QTP test folder'
  qtpApp.Open folderObj.Path, True, False
   sResultFolderPath = sPath&amp;folderObj.Name &amp; "\Res" 'Set the results location'
   qtpResObj.ResultsLocation = sfolderPath
  
   qtpApp.Test.Run qtpResObj , True
   strResult = qtpApp.Test.LastRunResults.Status
   WScript.echo strResult
   qtpApp.Test.Close
   End if
   Next
   'Send Mail
   qtpApp.Quit
   'Release the file System objects 
   Set testSubFolders = Nothing
   Set mainFolderObj = Nothing
   Set fsObj = Nothing 
   Set qtpResObj= Nothing 
  
   Function formatDate ()
   str= now ()
      str=replace(str,"/","")
      str=replace(str,":","")
      str=replace(str," ","")
      formatDate = mid (str,1,len(str-2))
  End Function
  </code></pre>
  
  <p>Now I am trying to execute these batch file remotely through a Job that launch it.
  I am facing two issue :</p>
  
  <p>1st : I am having  a Interactive Services Detection prompt with a pop up box where I should click on view the message in order to switch to another screen, this is an issue for me as I want UFT to be launched automatically without any user interaction.  </p>
  
  <p>2nd Issue : Using this script UFT is not starting even when I click on view message in the service interaction pop up.<br>
  I have searched in the internet and I have found a suggestion to open UFT first so I have added this snippet on the top of the script above :</p>
  
  <pre><code>dim commandLine, WshShell
  
  ' Define command line 
  commandLine = """C:\Program Files (x86)\HP\Unified Functional Testing\bin\UFT.exe"""
  Set WshShell = CreateObject("WScript.Shell")
  
  ' Start QTP via command line
  WshShell.Run commandLine, 8, true
  
  ' Wait a while until QTP is loaded (here 10 secs)
  WScript.Sleep 10000
  set WshShell=nothing  
  </code></pre>
  
  <p>With this script UFT is launched after I click on the Interactive Services Detection message but the testes are not starting.</p>
  
  <p>So to resume my question is how can I avoid the Interactive Services Detection and launch UFT directly and how I can get tests starting once UFT is launched.</p>
  
  <p>Thanks
  Zied   </p>