Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
launching and Closing QTP Application by using single file
#1
Solved: 11 Years, 4 Months ago
Hi
Friends
This is Shiva

I have an issue of launch script for launching QTP application.

I want to write code for the application if it is open it should be closed and if it is closed it should be opened.
Please help me to solve this problem
Thanks in advance Smile

1. This is the code to launch the QTP Application
Code:
Dim qtp_app
Set qtp_app = CreateObject("quicktest.application")
    If qtp_app.launch = false Then
      qtp_app.quit
      qtp_app.launch
      qtp_app.new
      qtp_app.visible=true
    End if
It is working

2. This is the code to close the qtp application
Code:
Dim qtp_app
Set qtp_app = CreateObject("quicktest.application")
    If qtp_app.visible = true Then
      qtp_app.quit
      Set qtp_app=nothing
    End if
It is working

But when we are giving the condition for launch and close in the single file it is not working
Code:
Dim qtp_app
Set qtp_app = CreateObject("quicktest.application")
    If qtp_app.visible = true Then
      qtp_app.quit
      Set qtp_app=nothing
    End if
  If qtp_app.launch = false Then
      qtp_app.quit
      qtp_app.launch
      qtp_app.new
      qtp_app.visible=true
    End if

what is the solution ?
Reply
#2
Solved: 11 Years, 4 Months ago
Hi,

Check with the below code:
Code:
Dim qtp_app
Set qtp_app = CreateObject("quicktest.application")
If qtp_app.launch = False Then
    qtp_app.quit
    qtp_app.launch
    qtp_app.new
    qtp_app.visible=True
End if

WScript.sleep 3000

If qtp_app.visible = True Then
qtp_app.quit
Set qtp_app=nothing
End if
Reply
#3
Solved: 11 Years, 4 Months ago
Thank you Smile
Can u explain me the reason

I have asked for
If the QTP application is open when we execute this script it should quit,
if it is not launched then if we run the same script it should be launched but should be closed only if the script is executed again
Reply
#4
Solved: 11 Years, 4 Months ago
Hi Vinay,

Here we go !!!

Check the below code for both conditions i.e Launching and Closing QTP by using single file/script.

Condition1: If we execute this script, if Launch=False and if QTP is Visible then it will closes QTP.

Condition2: If we execute the same script, if Launch=False and Not Visible then it would launch QTP.

Code:
Dim qtp_app
Set qtp_app = CreateObject("quicktest.application")
If (qtp_app.Launch=False) And (qtp_app.visible=True) Then
         qtp_app.quit
Else
     If (qtp_app.Launch=False) And (qtp_app.visible=False) Then
         qtp_app.launch
         qtp_app.visible=True        
    End if
End if
Set qtp_app=Nothing
Reply
#5
Solved: 11 Years, 4 Months ago
Thank you Bro Smile
It is working
Why we are using launch=false in the both cases

Its not Vinay ,Its V.N.S.kumar
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SAP GUI gets hanged while closing the Windows Pop Up kathirvelnagaraj 0 5,534 10-23-2015, 06:47 PM
Last Post: kathirvelnagaraj
  UFT 12.02 Launching default home page sureshbl 0 3,308 06-01-2015, 02:15 AM
Last Post: sureshbl
  Launching .exe file with parameters magnifyingone 1 3,172 08-28-2014, 06:39 PM
Last Post: dplank
  How to convert a single dimension array to two dimensional array venkatesh9032 3 5,541 02-10-2014, 03:07 PM
Last Post: pranikgarg
  recovery scenario for closing a message box itself ashima 0 2,241 12-26-2013, 11:10 AM
Last Post: ashima

Forum Jump:


Users browsing this thread: 2 Guest(s)