VKontakte.DJ
forum traveling
 

Celestial Software

...better by design

Home Support Scripting Home Script Examples VBScript example: automatic logging

VBScript example: automatic logging

E-mail Print

Through the new scripting features of AbsoluteTelnet/SSH, users can now enable automatic session logging with this script.  The script uses two AbsoluteTelnet/SSH functions.  It uses Terminal.GetHostname to get the hostname which it uses to construct the logfile name, and Terminal.OpenLog to actually open the log. 

The rest is pure VBScript to get the date and time and to create the logfile string.  You can modify this script to customize how you wish to create the logfile name and where you wish to put it.  The default is "c:\logs".  At the end of the script, the logfile is opened and then the script terminates.  The terminal session remains active until the user terminates it and all of the session data is logged to the file.  This is similar to using the File->Open LOG feature at the beginning of every session.

You can put this script in Options->Properties->Scripts if you want it only to apply to the currently open session profile.  Alternatively, you can place it in the global startup script  on Options->Properties->Global to make log ALL sessions that you open. 

Sub Main
DIM timevalue
DIM datestring
DIM timestring
Dim hostname
Dim filename

timevalue=Now
datestring=CStr(Year(timevalue))+"_"+CStr(Month(timevalue))
+"_"+CStr(Day(timevalue))
timestring=CStr(Hour(timevalue))+"_"+CStr(Minute(timevalue))
+"_"+CStr(Second(timevalue))
hostname=Terminal.GetHostname

filename="c:\logs\"+hostname+"_"+datestring+"_"+timestring+".txt"

Terminal.OpenLog(filename)
End Sub

 

 

Related Links: VBScript API , Scripting Home

Last Updated on Friday, February 27, 2009 01:04 am  

Recent Forum Posts

info in Secure Shell by bpence, Apr 12, 2024 02:24 pm
info in Secure Shell by bpence, Jan 29, 2024 09:01 am
info in Secure Shell by bpence, Nov 17, 2023 09:44 am
info in AbsoluteTelnet General by bpence, Nov 14, 2023 06:55 am
info in Configuration issues by taa1, Nov 05, 2023 04:26 pm
I've tried lots of different telnet/ssh clients, and I have two long-time favorites: Putty and Absolute Telnet. Putty, because it's such a quick download that on someone else's machine i can run it without going through an install, and it runs ssh. But for my own machine, the only choice is Absolute Telnet. It stores my password, terminal appearance and connection settings so that it's literally 2 seconds from clicking the icon to being logged in to my remote ssh accounts. It's incredibly customizeable, but not overwhelmingly so. I hardly ever pay for software (I'm embarassed to say), but I like Absolute Telnet so much I've paid for the full version and I'm glad I did. It's important to note that this software is maintained by one guy, Brian Pence, who personally answers people's questions on his online forum and answers email inquiries (he's answered a couple of mine, and always been really helpful). I gotta say, you hardly ever get this kind of commitment and personal touch in software anymore. --Ben Wheeler