Chapter 8. Skype Chat and Voicemail
Section 8.1. Hacks 7073: Introduction Hack 70. Log Chat Sessions Outside of Skype Hack 71. Automatically Forward Voicemail Hack 72. Listen to Voicemail Using a USB Handset Hack 73. Run Commands Remotely Using Chat |
8.1. Hacks 7073: IntroductionSometimes it is easy to forget that Skype is about more than just voice calls. Skype chat and voicemail are key features of Skype in their own rightand both are well worth hacking!
|
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
You can set up Skype to keep a history of your chat sessions (select Skype
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
|