Hack70.Log Chat Sessions Outside of Skype


Hack 70. Log Chat Sessions Outside of Skype

Skype can keep a history of your chat sessions, but there are many reasons why you might want to log chat sessions outside of Skype: to publish to a blog, or as an RSS feed, or just as a permanent record, for instance. This hack shows you how to build your own simple chat logger.

Works with: Windows version of Skype.

There are a multitude of reasons why you might want to keep a permanent record of your chat sessions outside of Skype in the form of a simple text file. Having such a file might be useful if you want to publish your chats to a blog, or as an RSS feed, or just for your records. Whatever the reason, switching chat logging on and off is a snap using this hack.

You can set up Skype to keep a history of your chat sessions (select Skype Tools Options Privacy Keep chat history), but each session is kept separately. So if you want the text for a particular chat session, or all chat sessions, youd better brace yourself for a lot of cut and paste! This hack provides a means of creating a single logfile outside of Skype for all of your chat sessions.

This hack uses two scripts, start_chat_log.vbs and stop_chat_log.vbs, to start and stop logging of chat sessions, respectively.

Use this script, start_chat_log.vbs, to start logging a Skype chat session:

 ' File: start_chat_log.vbs ' To use this script yourself, you will need to change ' the path and filename of the chat log file stored ' in the variable strLogFile. Dim objFSO, objLogFile, objSkype, objSemaphore Dim strTempFolder, strSemaphoreName, strLogFile Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") Set objSkype = WScript.CreateObject("SkypeAPI.Access", _                                     "SkypeAPI_") strLogFile = "C:\Temp\Skype\ChatLog.txt" Set objLogFile = objFSO.OpenTextFile(strLogFile, 8, True) ' Skype event handlers Sub SkypeAPI_ChatMessageSent(ChatMessage) Dim msg_from Set msg_from = ChatMessage.MessageFrom     objLogFile.WriteLine("Chat sent by " & msg_from.Handle & _                          " at " & Now & ":")     objLogFile.WriteLine(ChatMessage.Body)     objLogFile.WriteLine("") End Sub Sub SkypeAPI_ChatMessageReceived(ChatMessage) Dim msg_from Set msg_from = ChatMessage.MessageFrom     objLogFile.WriteLine("Chat received from " & msg_from.Handle & _                          " at " & Now & ":")     objLogFile.WriteLine(ChatMessage.Body)     objLogFile.WriteLine("") End Sub ' Main script begins here strTempFolder = objFSO.GetSpecialFolder(2) strSemaphoreName = objFSO.BuildPath(strTempFolder, _                                     "chat_logging.tmp") Set objSemaphore = objFSO.CreateTextFile(strSemaphoreName, true) objSemaphore.Close objSkype.ConnectAndWait 15000 Do While objFSO.FileExists(strSemaphoreName)     WScript.Sleep 500 Loop objLogFile.Close 

Use this script, stop_chat_log.vbs, to stop logging a Skype chat session:

 ' File: stop_chat_log.vbs ' Main script begins here Dim objFSO, strTempFolder Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") strTempFolder = objFSO.GetSpecialFolder(2) objFSO.DeleteFile objFSO.BuildPath(strTempFolder, _                                    "chat_logging.tmp") 

The easiest way to use these scripts is to turn them into shortcuts and assign them hotkeys. Create a shortcut named Start Chat Log that points to start_chat_log.vbs as its target, then right-click on the shortcut and choose Properties. In the shortcut properties dialog that is displayed, select the tab named Shortcut, click on the text entry field opposite "Shortcut key," press the key sequence you want as your hotkey (for example, Shift-Alt-L for "Log"), and then click OK. Do the same for stop_chat_log.vbs, giving its shortcut the name Stop Chat Log and a different hotkey sequence (for example, Shift-Alt-O for "Off"). Now, beforeor even duringa chat session, you can switch logging on and off using only a couple of hotkey sequences!




Skype Hacks
Skype Hacks: Tips & Tools for Cheap, Fun, Innovative Phone Service
ISBN: 0596101899
EAN: 2147483647
Year: 2005
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net