View Single Post
Old 02-18-2020, 09:12 PM
baf28 baf28 is offline
Registered User
Join Date: Feb 2020
Posts: 4
Originally Posted by bgagnon View Post
Hi baf28,

Are you saying you have configured Prompt in the Send delay options grouping in the Terminal / Emulation / Advanced category of Session Options?

If so, you can't presently specify multiple prompts.

I have added this thread to a feature request in our product enhancement database for the ability to specify multiple prompts for the send delay prompt option. Should a future release of SecureCRT include this feature, notification will be posted here.

If you prefer direct email notification, send an email to and include Feature Request - Forum Thread #14082 in the subject line or use this form from the support page of our website.
Thank you, I will wait for the developers to implement this.
In the meantime, I made a script that does this and stops when it detects an error. If itís not difficult for you, look at it and maybe you will find errors in it. I would be very glad if you could help me make the script better.

# $language = "python"
# $interface = "1.0"

# Description:
#   Скрипт вставляет данные из буфера обмена и ждет определенные совпадения прежде
#   чем вставит следующую строку
#   Если скрипт зависнет или остановистя, то можно продолжать вводить данные и отменить скрипт

import SecureCRT
import time

crt.Screen.Synchronous = True
crt.Screen.IgnoreEscape = True

def main():
    # If there isn't an active connection, there's no point in continuing
    # since we can't send data.
    if not crt.Session.Connected:
        crt.Dialog.MessageBox("Для отправки данных требуется активное соединение.")
    # If there isn't anything in the clipboard, it doesn't make any
    # sense to continue with the script.
    if crt.Clipboard.Text.strip() == "":
        crt.Dialog.MessageBox("Текст не найден в буфере обмена.")
    # Keep timing information so that we can display how long it took for the
    # data to be sent to the remote (each line sent only after the prior line
    # was echo'd back to SecureCRT, as a flow control mechanism).
    nStartTime = time.time()

    # Multiple lines in the clipboard are typically stored with a CRLF
    # separator, but this script example tries to accommodate other line endings
    # that might be supported by some editors. Break up lines into an array
    # (each line as an element within the array).
    if crt.Clipboard.Text.find("\r\n") > -1:
        vLines = crt.Clipboard.Text.split("\r\n")
    elif crt.Clipboard.Text.find("\n") > -1:
        vLines = crt.Clipboard.Text.split("\n")
        vLines = crt.Clipboard.Text.split("\r")

    AllLineNumber = len(vLines)
    nLineNumber = 1
    sWait = 0
    for strLine in vLines:
        # Send the next line to the remote
        crt.Screen.Send(strLine + "\r")
        bSuccess = crt.Screen.WaitForStrings(["#", "$", "Error","Command not allowed for this user","Command authorization failed"], int(sWait))
        if (bSuccess == 3):
            crt.Dialog.MessageBox("Обнаружена ошибка \"Error\" ! \r\n\r\n"
                                  "%d строки из буфера обмена были отправлены." % (nLineNumber-1))
        if (bSuccess == 4):
            crt.Dialog.MessageBox("Команда не разрешена для этого пользователя! \r\n\r\n"
                                  "%d строки из буфера обмена были отправлены." % (nLineNumber-1))
        if (bSuccess == 5):
            crt.Dialog.MessageBox("Ошибка авторизации! \r\n\r\n"
                                  "%d строки из буфера обмена были отправлены." % (nLineNumber-1))

        nLineNumber += 1
    # Calculate seconds elapsed
    nTimeElapsed = time.time() - nStartTime
    # Inform that the data has all been sent.
        "{:d} строки из {:d} были отправлены с буфера обмена. \r\n\r\n"
        "Время выполнения: {:.2f} секунд.".format(nLineNumber-1,AllLineNumber,nTimeElapsed))

Reply With Quote