Jump to content
Sign in to follow this  
BernyHsu

Problem with ControlGetText() in SecureCRT

Recommended Posts

BernyHsu

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 

Share this post


Link to post
Share on other sites
BernyHsu

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

Share this post


Link to post
Share on other sites
junkew

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

  • Like 1

Share this post


Link to post
Share on other sites
BernyHsu

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. 

Share this post


Link to post
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
Sign in to follow this  

×