Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-24-2019, 09:46 AM
bwoo bwoo is offline
Registered User
 
Join Date: Apr 2019
Posts: 1
Question Saving/restoring log file name with variables

I have a question about log files and scripts.

I routinely capture my SecureCRT sessions using a log file name with variables, e.g. "%Y_%M_%D %S.log"

I also have to occasionally run a script which captures a bunch of information in separate log files. This script fails when I run it because I already have a log file open.

I am rewriting the script so that it checks for an existing capture and, if there is one, it saves the current capture file name and closes it:
If crt.Session.Logging = True Then
bPreviousCapture = True
strPreviousCapture = crt.Session.LogFileName
crt.Session.Log False
Else
bPreviousCapture = False
End If
The original log file is restored at the end of the script:
If bPreviousCapture = True Then
crt.Session.LogFileName = strPreviousCapture
crt.Session.Log True, True
End If
Unfortunately, crt.Session.LogFileName returns the capture file name with the variables already populated, so once the script is finished my capture file name is fixed instead of variable.

Is there a way to save and restore the proper capture file name with the variables intact?
Reply With Quote
 

Tags
capture , log file , script , variables

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 06:58 AM.