Jump to content

Problem with ControlGetText() in SecureCRT


Go to solution Solved by junkew,

Recommended Posts

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

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 by BernyHsu
Link to comment
Share on other sites

  • Solution

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

Link to comment
Share on other sites

  • 1 month later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...