Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - How to open an application through scripting?




262
views
asked marvit August 19, 2014 12:16 AM  

How to open an application through scripting?


           

1 Answers



 
answered By Dharma   0  

  1. Create a “WScript.shell” object.
  2. Use the “run” object to launch the application. If the path to your executable contains spaces, use Chr(34) to ensure the path is contained within double quotes.
  3. When done, set the shell object to nothing to release it.

Example

Dim oShellSet oShell = CreateObject ("Wscript.shell")'
  'Example 1 - run a batch file:
  oShell.run "F://jdk1.3.1/demo/jfc/SwingSet2.bat"
  'Example 2 - run a Java jar file:
  oShell.run "java -jar F://jdk1.3.1/demo/jfc/SwingSet2/SwingSet2.jar"
  'Example 3 - launch Internet Explorer:
  oShell.Run Chr(34) & "C://Program Files/Internet Explorer/IEXPLORE.EXE" & Chr(34)
  Set oShell = Nothing
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert