HippoMan Posted August 22, 2021 Share Posted August 22, 2021 I want to use AutoIt under Windows 10 to automate a PuTTY session. However, AutoIt is not recognizing any text inside of the PuTTY window. This is what I have done ... #include <Constants.au3> ;; The following creates new window to a PuTTY ssh session on ;; a different machine and waits for this window to become ;; active. The title of the window is "aa" ... Run("putty.exe -load aa") $w = WinWaitActive("aa") ;; The following properly pops up after the ssh window is fully open and active ... MsgBox($MB_OK, "Status", "ssh window open") ;; This properly waits 5 seconds. Text is showing in the ssh window ... Sleep(5000) $text = WinGetText("aa") ;; But this just pops up an empty message box with the title "Text" ... MsgBox($MB_OK, "Text", $text) I also tried WinGetText($w), and I got the same results. I want to capture the PuTTY window text. What am I doing incorrectly? Thank you very much in advance. Link to comment Share on other sites More sharing options...
HippoMan Posted August 22, 2021 Author Share Posted August 22, 2021 PS: I have seen other posts here about controlling PuTTY, but they don't address this particular issue because ... (1) ... they are invoking PuTTY via a "cmd" window. This will not work for me, because I need to use a fully-fledged PuTTY-created window which is managing an xterm-based terminal session. (2) ... I could not find any examples where the text from a PuTTY terminal window is being read and examined. I only see cases where "Send" is used to send text to the PuTTY terminal window without first checking what text already appears in that PuTTY terminal window. Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted August 23, 2021 Share Posted August 23, 2021 I have nothing I can use for testing right now, but I can say in the past I used PLINK for my Putty automation. If you use the AutoIT window info tool and you do not see any text listed, then you will not get anything from WinGetText() I want to say you can have Putty pretty much log everything to a log file as its running, and then you can read that file as a workaround. Earthshine 1 Link to comment Share on other sites More sharing options...
junkew Posted August 28, 2021 Share Posted August 28, 2021 Ctrl+insert keyboard copies all to clipboard. Use mousedrag to select area of text and toen Ctrl c FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Zedna Posted August 28, 2021 Share Posted August 28, 2021 Try to look at the results of this search: https://www.autoitscript.com/forum/search/?q=putty&search_in=titles junkew 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now