View Single Post
  #1  
Old 02-02-2019, 04:10 AM
Caiser Caiser is offline
Registered User
 
Join Date: Aug 2015
Posts: 4
SecureCRT to SendKeys with Python

As checked the help file , with python, can not send a key to the screen.

I am using python2.7.15.
What can I alternatively do to send the ^C(which is supposed to be CTRL+C) to the screen with python?


SendKeys
Description
Sends key strokes to the active window.
Remarks
The SendKeys method can send more than one keystroke at a time by using compound string arguments. For example, to send the keystrokes a, b, and c, you would send the string argument "abc". The SendKeys method also uses some characters as modifiers of characters. This set of special characters consists of the plus sign (+), caret (^), percent sign (%), tilde (~), parentheses, brackets, and braces. The characters "+", "^", and "%" perform the functions of SHIFT, CTRL, and ALT, respectively. These can be combined to affect one key as in "^%c" which is the equivalent of the CTRL+ALT+C key combination. Parenthesis characters are used to group characters for modifiers, for example, "+(ec)" will send "EC". SendKeys can use up to three nested parenthesis.

To send bracket characters, send the string argument "{[}" for the left bracket and "{]}" for the right one. To send brace characters, send the string argument "{{}" for the left brace and "{}}" for the right one.

Some keystrokes do not generate characters (such as ENTER and TAB). Some keystrokes represent actions (such as BACKSPACE and BREAK). To send these kinds of keystrokes, send the arguments shown in the SendKeys keystroke table.
VBScript
Syntax
object.SendKeys string
Example
#$language = "VBScript"
#$interface = "1.0"
Sub Main()
crt.Screen.Clear
crt.screen.sendkeys("mc~")
crt.Sleep 2000
crt.screen.sendkeys("{f1}")
crt.Sleep 2000
crt.screen.sendkeys("{esc}0")
crt.Sleep 2000
crt.screen.sendkeys("{esc}0")
crt.Sleep 2000
crt.screen.sendkeys("y")
End Sub
Python
Syntax
SendKeys is not currently supported for Python.
Reply With Quote