Run application using QTP, if not running already!!

Hello Friends,

Sometimes we need to check whether any particular application is running or not, and if not, then run it.

In this post we are going to do that through QTP!!

Here we will check and run Internet Explorer, if not running already..

Dim flag, AllProcess, AppToRun
AppToRun = “iexplore.exe”
Flag = Flase
Set AllProcess = GetObject(“winmgmts:”)

For Each Process In AllProcess.InstancesOf(“Win32_process”)
    If (Instr ((Process.Name), AppToRun) = 1) Then
        Print “Internet Explorer is running..”
        Flag = Ture
        Exit For
    End If

If Flag = Flase Then
    Print “Internet Explorer not is running..”
    SystemUtil.Run AppToRun
End If

You can do the same for any process/application. You just need to change the value of AppToRun variable. 🙂

5 thoughts on “Run application using QTP, if not running already!!”

  1. Hi , i got one scenario . the script line states as Browser("").page("").webtable("").webtable("").webelement("").set/click/GETROProperty…

    here above case , the webtable names (any one in the flow ,in some cases two ) changed as dynamically like date and time (Ex: 14/05/2013 10:10)and some times 6digit number (any number)in another case
    so ,like this changing the webtable names , how can capture names and properties .and how to manage the Object repository for parameterising the above script ?
    or if it is descriptive how to manage ?
    and if Regular Expressions then can you give me in detailed ,please waiting for help !!!
    Thank you.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top