Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #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
  #2  
Old 04-24-2019, 10:03 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi bwoo,

Probably. I think you would just want to get at the data using SessionConfiguration object instead (before enabling logging).

What version of SecureCRT are you using?

The option associated with your log file info is Log Filename V2. See the info for GetOption() and SetOption() methods in the Help topic Scripting / Script Objects Reference / SessionConfiguration Object.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply

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 02:51 AM.