]> git.pld-linux.org Git - packages/python-skype.git/commitdiff
- sample script to open skype chat (tie it with your browser for skype: protocol)
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 20 Apr 2009 12:59:30 +0000 (12:59 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    python-skype-chat.py -> 1.1

python-skype-chat.py [new file with mode: 0644]

diff --git a/python-skype-chat.py b/python-skype-chat.py
new file mode 100644 (file)
index 0000000..4de2d69
--- /dev/null
@@ -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()
This page took 0.075163 seconds and 4 git commands to generate.