SOURCES: python-skype-chat.py (NEW) - sample script to open skype chat (tie...
glen
glen at pld-linux.org
Mon Apr 20 14:59:36 CEST 2009
Author: glen Date: Mon Apr 20 12:59:36 2009 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- sample script to open skype chat (tie it with your browser for skype: protocol)
---- Files affected:
SOURCES:
python-skype-chat.py (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/python-skype-chat.py
diff -u /dev/null SOURCES/python-skype-chat.py:1.1
--- /dev/null Mon Apr 20 14:59:36 2009
+++ SOURCES/python-skype-chat.py Mon Apr 20 14:59:30 2009
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+# ---------------------------------------------------------------------------------------------
+# Python / Skype4Py example that takes a skypename from command line parameter,
+# checks if that skypename is in contact list and if yes then starts a chat to that skypename.
+#
+# Tested with Skype4Py version 1.0.31.0 and Skype verson 2.0.0.72
+
+import sys
+import Skype4Py
+
+# Let's see if we were started with a command line parameter..
+try:
+ CmdLine = sys.argv[1]
+except:
+ print 'Missing command line parameter'
+ sys.exit()
+
+# strip skype: prefix
+if CmdLine[:6] == "skype:":
+ CmdLine = CmdLine[6:]
+
+# Creating Skype object and assigning event handlers..
+skype = Skype4Py.Skype()
+
+# Starting Skype if it's not running already..
+if not skype.Client.IsRunning:
+ print 'Starting Skype..'
+ skype.Client.Start()
+
+# Attatching to Skype..
+print 'Connecting to Skype..'
+skype.Attach()
+
+# Checking if what we got from command line parameter is present in our contact list
+Found = False
+for F in skype.Friends:
+ if F.Handle == CmdLine:
+ Found = True
+ print 'Chatting ' + F.Handle + '..'
+ chat = skype.CreateChatWith(CmdLine);
+ chat.OpenWindow()
+ break
+
+if not Found:
+ print 'Call target not found in contact list'
+ sys.exit()
================================================================
More information about the pld-cvs-commit
mailing list