Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
open Putty via QTP
#1
Solved: 10 Years, 9 Months ago
hello,

Can we open putty via QTP without Terninal Emulator Add-in?
Reply
#2
Solved: 10 Years, 9 Months ago
Yes you can. It is just like any other application. Here are two functions I wrote for Putty. You can type in the putty client just like a cmd dialog.

Code:
Function closePutty()
    'This Closes the Putty Window.
    Dim AppCount

    On Error Resume Next
    InfoLog "Closing Putty"
    If window("PuTTY").Exist(0) Then
        window("PuTTY").Type "Quit"
    End If

    If window("PuttyConfig").Exist(0) Then
        Window("PuttyConfig").Close
    End If

    If window("PuTTY").Exist(0) Then
        Window("PuTTY").Close
        Window("PuTTY").Dialog("PuTTY Exit Confirmation").WinButton("OK").Click
    End If
End Function

Function startPutty(sServerIP,sPort,bWindowTitle,sWindowName)
    'This function will start the Putty Application.
    'sServerIP is the Server IP to connect too.
    'sPort is the port to be connecting too.
    'bWindowTitle is whether you want to change the name of the window.
    'sWindowName is the name of the window that will be changed too.
    Dim SettingsFile

    On Error Resume Next
    closePutty
    InfoLog "Starting Putty"
    SettingsFile="C:\Program Files\PuTTY\putty.exe"
    If fso.FileExists(SettingsFile)=False Then 'Verify that Putty is installed.
        ErrorLog  SettingsFile & " does not exist."
        startPutty=False
        Exit Function
    Else
        startPutty=True
    End If
    SystemUtil.Run "C:\Program Files\PuTTY\putty.exe", "", "", ""
    Window("PuttyConfig").WinRadioButton("Telnet").Set
    Window("PuttyConfig").WinEdit("Host Name").Set sServerIP
    Window("PuttyConfig").WinEdit("Port").Set sPort
    If bWindowTitle=True Then
        Window("PuttyConfig").WinTreeView("Category:").Select "Window;Behaviour"
        Window("PuttyConfig").WinEdit("Window title:").Set sWindowName
    End If
    
    Window("PuttyConfig").WinButton("Open").Click
    Wait(5)
    If bWindowTitle=False Then
        window("PuTTY").Activate
        window("PuTTY").Type micReturn
    End If

    ErrorCatcher Err.Number, Err.Description
    Err.Clear
End Function

If you have any further questions please ask.
Reply
#3
Solved: 10 Years, 9 Months ago
Thanks for the Reply.

Can you please tell me if it is possible to Telnet an Ip from RUN via QTP without help of TE Add-in?

Regards,
Rachna
Reply
#4
Solved: 10 Years, 9 Months ago
Yes, I do it all the time either with both Putty and the cmd prompt.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP does not record the first step of open filight reservation application. Blossoms 9 17,308 07-20-2015, 05:50 PM
Last Post: AJAJ
  QTP(UFT) and putty hachem 0 3,689 03-03-2015, 05:16 PM
Last Post: hachem
  When QTP is open am not able to open my AUT. chetan3987 2 2,933 02-12-2014, 01:18 AM
Last Post: supputuri
  How to enter values into excel which is already open using QTP Narayanan 1 4,190 12-11-2013, 07:30 AM
Last Post: basanth27
  cannot open QTP tests learnasugo 8 8,733 10-18-2012, 11:28 AM
Last Post: Ankesh

Forum Jump:


Users browsing this thread: 1 Guest(s)