Hi,

Hope you have already carried out TE addin settings for putty. Pasted below
is a function to login into putty and then entering the user id and pwd.



'#********************************************************************************
'#Function Name    : UdsLoginToPutty
'#Description      : Sub to Login to Putty
'#Input Parameters : None
'#Output Parameters: None
'#********************************************************************************
Public sub UdsLoginToPutty(strGenUid,
strGenPwd,strSwisslogUserName,strSwisslogpwd)
SystemUtil.run "C:\Program Files\PuTTY\putty.exe","","",""

With window("regexpwndtitle:=putty configuration")
  .activate
  .winedit("nativeclass:=edit","attached text:=Host.*").type
"wmstst"'&servername or IP
  '.winedit("nativeclass:=edit","attached text:=&Port").type &portnumber
  .winradiobutton("nativeclass:=button","text:=&SSH").set
  .winbutton("text:=&open").click
End with
wait(10)

If TeWindow("TeWindow").exist Then
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Type strGenUid
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Type  micReturn
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Sync 1000
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Type strGenPwd
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Type  micReturn
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Sync 2000
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Type strSwisslogUserName
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Type  micReturn
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Sync 1000
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Type strSwisslogpwd
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Type  micReturn
TeWindow("TeWindow").TeTextScreen("TeTextScreen").Sync 2000
End If
End sub


e.g. with descriptive programming below code sample :


strval=Window("nativeclass:=PuTTY").GetVisibleText
If instr(strval,"Is location empty?") Then
Window("nativeclass:=PuTTY").Type "Y"
Window("nativeclass:=PuTTY").Type  micReturn
End if


On Fri, Apr 8, 2011 at 9:59 AM, Shanmukha Bollapragada
<[email protected]>wrote:

>  If anyone has any experience with putty and qtp. Please share. I need to
> see a simple script example which will open putty, login into a unix box
> with a specific username and password, and then issue a simple command like
> ls -ltr, pasrse the resullts and return it to the user
>
> Thank you
> Shan
>
>   --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en




-- 
Regards,


Ganesh Muralidharan
'God Never Forgets'

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to