VanDyke Software Forums

Go Back   VanDyke Software Forums > SecureCRT 5.2/SecureFX 4.0 Beta
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Display Modes
  #1  
Old 08-24-2006, 04:10 PM
toloughlin's Avatar
toloughlin toloughlin is offline
Senior Member
 
Join Date: Feb 2004
Location: Nashua, NH
Posts: 378
Can't find the right combo to send in login script

I've been digging through the forum for the way to send certain Ctrl+? commands in a login script, but am not doing so well.

I am using an ancient dialer - minicom on a linux box.

I have the login script working to the point that I get the main screen - but need to execute Ctrl+A d .

I tried some octal codes - but it just echoes it to the screen.

Any help would be appreciated.

Thanks!
__________________
----------------------------------------------
Tom O'Loughlin
  #2  
Old 08-25-2006, 08:38 AM
rlpm's Avatar
rlpm rlpm is offline
VanDyke Developer
 
Join Date: Jun 2004
Location: Albuquerque, NM
Posts: 69
Hi Tom,

Using the built-in expect/send "Automate logon" scripting capability, you should be able to send Ctrl-A then 'd' by using the string "\001d".

Or, in a VBScript, you could do: crt.screen.send chr(1) & "d"

Does this help?

Regards,
--rlpm
  #3  
Old 08-25-2006, 11:30 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,099
If you don't want to go through a manual conversion process, you can create a function to do it for you (e.g. crt.Screen.Send Ctrl("A") & "d").

Here's an example of such a function that will convert an ASCII character to it's "Control" equivalent:
Code:
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Function Ctrl(character)
' Returns an empty string if character is invalid (valid
' characters are comprised of the ASCII characters between
' '@' and '_', inclusive)

    ' We only support one character at a time, and it doesn't
    ' make sense to allow for an empty string
    if len(character) <> 1 then exit Function

    ' If you want to allow for lower-case characters to be
    ' accepted (e.g. Ctrl("a") means the same thing as
    ' Ctrl("A"), simply UpCase the character:
    ' character = UpCase(character)

    if asc(character) < 64 then exit Function
    if asc(character) > 95 then exit Function

    '   ASCIIControlCode = chr(asc(<ASCII value of upper-case character>) - 64)
    Ctrl = chr(asc(character) - 64)
end Function
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
  #4  
Old 08-25-2006, 01:02 PM
toloughlin's Avatar
toloughlin toloughlin is offline
Senior Member
 
Join Date: Feb 2004
Location: Nashua, NH
Posts: 378
Quote:
Originally Posted by rlpm
Using the built-in expect/send "Automate logon" scripting capability, you should be able to send Ctrl-A then 'd' by using the string "\001d".
This is the way that I was doing it .... but I was a little off - I had "0001d". What's happening now, is a <cr> after the d ... know of a way to not do that?
Quote:
Or, in a VBScript, you could do: crt.screen.send chr(1) & "d"
In an auto-login type scenario, how would I kick this off?

Thanks!
__________________
----------------------------------------------
Tom O'Loughlin
  #5  
Old 09-08-2006, 12:04 AM
toloughlin's Avatar
toloughlin toloughlin is offline
Senior Member
 
Join Date: Feb 2004
Location: Nashua, NH
Posts: 378
Hi jdev,

I haven't done much with VBScript & Windows ... so I'm a bit lost.

Do you know if its possible to remove the <CR> / Enter ... that's sent after the \0001d ? I'd just like to send Ctrl+A d ... that's all - no 'enter' after.

Thanks!
__________________
----------------------------------------------
Tom O'Loughlin
  #6  
Old 09-08-2006, 03:50 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,099
Quote:
Originally Posted by toloughlin
Do you know if its possible to remove the <CR> / Enter ... that's sent after the \0001d ? I'd just like to send Ctrl+A d ... that's all - no 'enter' after.
I'm not sure which mechanism you're currently using...

Are you saying that you get a CR when using crt.Screen.Send from within a vbscript (Logon script), or when using the simple Expect / Send (Automated logon) mechanism?


Quote:
Originally Posted by toloughlin
This is the way that I was doing it .... but I was a little off - I had "0001d". What's happening now, is a <cr> after the d ... know of a way to not do that?
If you're using the Automate logon option (simple Expect / Send mechanism) in the Logon Scripts category of the Session Options dialog, the Send field always implies a CR at the end, and currently there isn't an option in SecureCRT that will allow you to suppress the automatic CR appendage in this scenario.

Perhaps you're looking for an option that would suppress the automatic CR appendage in the simple Expect / Send mechanism? This seems like a good thing to have, so I'll create a feature request for suppressing the automatic CR at the end of each Send in the Automate logon config.

The best bet without such an option would be to go with a Logon script (see below).


Quote:
Originally Posted by toloughlin
In an auto-login type scenario, how would I kick this off?
Disable the Automate logon option in the Logon Scripts category of the Session Options dialog. Instead, enable the Logon script option and specify the path to the VBScript file that contains your code.

Note that logon scripts will be launched at different times, depending on the protocol used for the session.
  • With Serial and Telnet protocols, the logon script is run as soon as a connection is successfully made (either to the remote machine via network, or to the COM port via cable, respectively).
  • With the TAPI protocol, the logon script is launched as soon as the remote has answered and modem negotiation has been successful.
  • With SSH1 and SSH2 protocols, the logon script is launched as soon as a successful authentication is detected.

Also (in case you're wondering) although the Automate logon and Logon script options are typically used in an either-or fashion, they can be combined. If both options are enabled, the Logon script is launched after the simple Expect / Send steps in the Automated logon setup are completed.

Does this information help, or were you looking for something else?

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:38 AM.


copyright 1995-2017 VanDyke Software, Inc.