Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Please explain this code

This is a discussion on Please explain this code within the QTP forums, part of the Software Testing category; ApplicationDir = Environment("ProductDir") ApplicationPath = "\samples\flight\app\flight4a.exe" SystemUtil.Run ApplicationDir & ApplicationPath,"",ApplicationDir & "\flight\app\","open" Please explain this code. This code is opening the lflight42.exe file, by searching the application DIr and then ...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 02-25-2008
Moderator
 
Join Date: Sep 2006
Location: Delhi (India)
Posts: 910
Thanks: 12
Thanked 106 Times in 74 Posts
jainbrijesh will become famous soon enoughjainbrijesh will become famous soon enough
Please explain this code

ApplicationDir = Environment("ProductDir")
ApplicationPath = "\samples\flight\app\flight4a.exe"

SystemUtil.Run ApplicationDir & ApplicationPath,"",ApplicationDir & "\flight\app\","open"

Please explain this code. This code is opening the lflight42.exe file, by searching the application DIr and then path tell the path from that DIR to application to run.

I want a little bit explanation about 3rd statement.
__________________
--
Brijesh Jain
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-25-2008
Moderator
 
Join Date: Oct 2007
Location: Frankfort, KY
Posts: 283
Thanks: 3
Thanked 54 Times in 36 Posts
Anshoo_Arora is on a distinguished road
Re: Please explain this code

Jainbrijesh,

Another way this can be done is by combining both ApplicationDir and ApplicationPath. For example:

strAppLocation=Environment(“ProductDir”) & “\samples\flight\app\flight4a.exe”

So, when you want to run the application, all you do is this:

SystemUtil.Run “flight4a.exe”, “”, strAppLocation, “open”

Usage: SystemUtil.Run "NameOfFile", "Paramters", "FilePath", "OperationToBePerformed"

Just another way… well, the third statement basically invokes the application during run session using a SystemUtil.Run statement. SystemUtil.Run statement enables you to open or run any application from a given location. Similarly, you can use SystemUtil to also close applications like this:

SystemUtil.CloseProcessByName “explorer.exe”

Last edited by Anshoo_Arora; 02-25-2008 at 12:00 PM.
Reply With Quote
  #3 (permalink)  
Old 02-25-2008
Expert Member
 
Join Date: Sep 2007
Location: Hyderabad
Posts: 112
Thanks: 1
Thanked 19 Times in 15 Posts
rajaputra is on a distinguished road
Re: Please explain this code

Hi Anshoo,

What you have explained to Mr.jain is correct.

But You cannot close the application by using SystemUtil.Run

We can use

SystemUtil.CloseProcessByName

For example...

SystemUtil.CloseProcessByName "Explorer.exe"

_________________

Rajaputra
Reply With Quote
The Following User Says Thank You to rajaputra For This Useful Post:
  #4 (permalink)  
Old 02-25-2008
Moderator
 
Join Date: Oct 2007
Location: Frankfort, KY
Posts: 283
Thanks: 3
Thanked 54 Times in 36 Posts
Anshoo_Arora is on a distinguished road
Re: Please explain this code

Rajaputra,

The application closes as you end the process. So it can be used to initiate as well as close an application.

Let's say, I have "iexplore.exe" as the process instead of "Explorer.exe". If I close "iexplore.exe" when a Browser is open, the process will close along with the Browser application.

EDIT: Wait, it is SystemUtil.CloseProcessByName and NOT SystemUtil.Run CloseProcessByName. I was mixing things up.

Sorry for the confusion. I didn't realize what I had written until I went back to my post. I will edit it.

Last edited by Anshoo_Arora; 02-25-2008 at 12:05 PM.
Reply With Quote
The Following User Says Thank You to Anshoo_Arora For This Useful Post:
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Explain the Difference Robert VB.NET 3 06-06-2007 11:19 AM
Can you explain the difference Remasri VB.NET 4 06-05-2007 10:28 AM
Explain the Difference christia Unix/Linux 1 07-30-2006 07:13 PM
Explain this term joel Unix/Linux 1 07-29-2006 04:18 PM
Explain about TNSPING admin Oracle 0 05-18-2006 08:53 PM


All times are GMT -4. The time now is 06:12 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved