VanDyke Software Forums

VanDyke Software Forums (
-   General (
-   -   Keymap adding variables to Send String (

ZekeB 01-09-2019 01:04 PM

Keymap adding variables to Send String
Here's my use case: I'm doing a tail -f on a file and I have a mapping to send a string that hits return several times, draws a line of dashes, then a few more returns.

That works fine. What I'd really like is the ability to insert variables into the string such as the current time as I've mocked up below.


Is there a way to do this? The session is in tail, so doing a date +%H:%M:%S or something similar that would have to be processed on the server won't help.

ZekeB 01-09-2019 01:11 PM

Answering my own question with a HORRIBLY ugly hack that I would be embarrassed to use. ;)

\n\n\n\n\032date\nfg %-\n\n\n\n

berdmann 01-09-2019 02:43 PM

Hi ZekeB,

There aren't any substitutions for date/time available in SecureCRT for plain mapped keys SEND STRING operations.

I have added a feature request on your behalf to add this functionality in SecureCRT.

If this functionality becomes available in a future version, we will be sure to let you know. If you would like to be notified directly please send an email to with "Feature Request Forum Post 13352" in the subject line.

In the mean time, you can get the behavior you desire by mapping your key combo to run a script instead of using the SEND_STRING function. For example:


# $language = "Python"
# $interface = "1.0"

import datetime
g_strDateTimeTag ="%H:%M:%S")

strLeaderDash = "-" * 30
crt.Screen.Send("\r\n\r\n\r\n{0}{1}{2}{3}{4}\r\n\r\n\r\n".format(strLeaderDash, "{", g_strDateTimeTag, "}", strLeaderDash), True)

ZekeB 01-10-2019 11:57 AM

Cool! Thank you very much, Brittney!

All times are GMT -6. The time now is 04:15 AM.