Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 01-09-2019, 01:04 PM
ZekeB ZekeB is offline
Registered User
 
Join Date: Jan 2019
Posts: 3
Question 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.


\n\n\n\n\n------------------{HH:MM:SS}---------------------------------\n\n\n

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.
Reply With Quote
  #2  
Old 01-09-2019, 01:11 PM
ZekeB ZekeB is offline
Registered User
 
Join Date: Jan 2019
Posts: 3
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
Reply With Quote
  #3  
Old 01-09-2019, 02:43 PM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 247
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 Support@VanDyke.com 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:

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

import datetime
g_strDateTimeTag = datetime.datetime.now().strftime("%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)
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #4  
Old 01-10-2019, 11:57 AM
ZekeB ZekeB is offline
Registered User
 
Join Date: Jan 2019
Posts: 3
Thumbs up

Cool! Thank you very much, Brittney!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 01:57 PM.