How to find local host name using QTP?

Answers were Sorted based on User's Feedback



How to find local host name using QTP?..

Answer / arunsingh

LHN=Environment.value("LocalHostName")
msgbox LHN

Run it, you will get you local host name.

Is This Answer Correct ?    13 Yes 1 No

How to find local host name using QTP?..

Answer / aiswaryan

Thanks Arun.
msgbox (environment("LocalHostName"))
this will also return the same. since these (LocalHostName,
OS etc) are built in environment variables, we can get the
values thro above syntax.

Is This Answer Correct ?    4 Yes 1 No

How to find local host name using QTP?..

Answer / aiswaryan

'Record the opening of command prompt in low level mode.
SystemUtil.Run "cmd","","C:\Documents and
Settings\<user>",""
wait 5
Record entering the text "hostname" in cmd prompt in Analog
mode .
Desktop.RunAnalog "Track2"
I have just started learning QTP. I am finding a proper
script to do the above task without recording in analog. If
anyone know please post the answers. Thx.

Is This Answer Correct ?    3 Yes 2 No

How to find local host name using QTP?..

Answer / sandeep

sorry this not the answer for this question . sorry.act I
want to post the ans for to open a notepad and write and
read contents of the notepad.once again sorry for
inconvience.

Thank You
Sailaja.

Is This Answer Correct ?    2 Yes 1 No

How to find local host name using QTP?..

Answer / ravi

if you like to hardcode its value, find here

control panel -> system -> general

Read the second line under Registered to:

Is This Answer Correct ?    0 Yes 5 No

How to find local host name using QTP?..

Answer / sailaja

The above code is giving error at for loop
Dim fso,notepad
set fso = createobject("scripting.filesystemobject")

file_path = "c:\nandu.txt"
'forwriting =2
'forreading = 1
set notepad = fso.createtextfile(file_path,1)
notepad.writeline "this is created by Nanda"
notepad.writeline"this is created on "

set notepad = fso.opentextfile(file_path,1)
Do
n = notepad.readline
msgbox n

Loop until ( notepad.atendofstream=true)

This will work fine.

Thank you
Sailaja

Is This Answer Correct ?    0 Yes 8 No

Post New Answer

More QTP Interview Questions

what are the issues we will get when there is migration from QTP 8.2 to QTP 10.0? Is there any problem in executing scripts of 8.2 on 10.0?

0 Answers  


If you have two monitors one is of 19inch and the 2nd one is of 24inch,if you want to write same QTP script in both the two monitors is there any changes required in the script?

0 Answers   Infosys,


How can i open 5 multiple browser at once through QTP VB script and i want to login with 5 different credentials i already tried with this code but its entering credentials only for first browser and am using datatable to parameterize

2 Answers  


Will QTP Support Japanese Language?

3 Answers   Cap Gemini, Infosys,


Can anybody help me by sharing the code for checkbox in qtp using vbscript.

2 Answers  






my assignment is,how can i differentiate between readed & unreaded mails in my inbox ?, since for both readed & unreaded having same properties for both test objects &run time objects

2 Answers  


Explain roles and responsibilites of 2yrs Automation qtp engineer.

3 Answers   Oracle,


How u call functions in QTP

5 Answers   Lehman Brothers,


WHAT IS DIFFERENCE B/W QC 9.2 AND QC 10.0

1 Answers   SoftTech,


Please anybody can tell the where can i get the information about pharma and bank testing, i put the pharma&bank projects in my resume, so i dont know what to tell about them, so where can i get the information and what we test for these, i need domain information, what r the screen we test?

0 Answers  


I am not finding pages and links in object spy on web testing. I am only getting window and winobject. where is the problem? thanks

4 Answers  


When to use descriptive programming?

0 Answers  


Categories