BernyHsu Posted August 15, 2014 Share Posted August 15, 2014 Hi Guys, I have a problem that using ControlGetText() in SecureCRT control. What my scripts is going to do is to input some commands in "Edit1" then get the response from "AfxFrameOrView100u1". The problem is after inputting a command then ControlGetText() gets nothing. I am wondering whether if "AfxFrameOrView100u1" is a common control which we can read the text or not. Besides that I've tried ControlGetText() in other controls of app and it works fine. Hope there is somebody have the same experience and the solution. Thanks! Local $sFeedBack = ControlGetText("Serial","","AfxFrameOrView100u1") ;get text from AfxFrameOrView100u1 FileWriteline ($sLogFile, "<br>" & "Result: " & $sFeedBack) ;Write the text to a log file Link to comment Share on other sites More sharing options...
BernyHsu Posted August 15, 2014 Author Share Posted August 15, 2014 (edited) Just found something on the Vandyke official site. It provides a VBscript which performs the result I want. So is it possible to do the same thing with Autoit? Thanks! http://www.vandyke.com/support/securecrt/scripts/getdata_vbs.txt # $language = "VBScript" # $interface = "1.0" Sub Main ' Send the unix "date" command and wait for the prompt that indicating ' that it completed. In general we want to be in synchronous mode before ' doing send/wait operations. ' crt.Screen.Synchronous = True crt.Screen.Send( "date" & vbCR ) crt.Screen.WaitForString( "linux$" ) ' When we get here the cursor should be one line below the output ' of the 'date' command. Subtract one line and use that value to ' read a chunk of text (1 row, 40 characters) from the screen. ' screenrow = crt.screen.CurrentRow - 1 Dim result result = crt.Screen.Get(screenrow, 1, screenrow, 40 ) ' Get() reads a fixed size of the screen. So you may need to use ' VBScript's regular expression functions or the Split() function to ' do some simple parsing if necessary. Just print it out here. ' MsgBox result crt.Screen.Synchronous = False End Sub Edited August 15, 2014 by BernyHsu Link to comment Share on other sites More sharing options...
Solution junkew Posted August 15, 2014 Solution Share Posted August 15, 2014 most likely but I am not aware that anyone has made AutoIT a scripting language that you can use within another host stuff like this should be possible but maybe the Developers of AutoIT know if anyone ever tried http://msdn.microsoft.com/en-us/library/fdee6589(v=vs.94).aspx http://msdn.microsoft.com/en-us/magazine/cc302278.aspx http://msdn.microsoft.com/en-us/magazine/cc301316.aspx I did not see an activex/COM object like secureCRT.application or something like that https://forums.vandyke.com/archive/index.php/t-7195.html BernyHsu 1 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...
BernyHsu Posted September 16, 2014 Author Share Posted September 16, 2014 most likely but I am not aware that anyone has made AutoIT a scripting language that you can use within another host stuff like this should be possible but maybe the Developers of AutoIT know if anyone ever tried http://msdn.microsoft.com/en-us/library/fdee6589(v=vs.94).aspx http://msdn.microsoft.com/en-us/magazine/cc302278.aspx http://msdn.microsoft.com/en-us/magazine/cc301316.aspx I did not see an activex/COM object like secureCRT.application or something like that https://forums.vandyke.com/archive/index.php/t-7195.html Great information!! Thank you Junkew. 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