![]() |
Home | What's New | Products | Download | Purchase | Support | About Us | Contact | Forums |
#1
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
Quote:
Quote:
Thanks!
__________________
---------------------------------------------- Tom O'Loughlin |
#5
|
||||
|
||||
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
|
||||
|
||||
Quote:
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:
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:
Note that logon scripts will be launched at different times, depending on the protocol used for the session.
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 | |
|
|