Reputation: 7807
i've installed skype4py. ( http://skype4py.sourceforge.net/doc/html/ )
i don't know python. i need a simple example script, that takes the first cmd argument as username and the second argument as message. this instant message should then be sent to the skype username.
does anyone know how to do this?
thanks a lot in advance
Upvotes: 1
Views: 20148
Reputation: 7538
For new readers YMMV.. Microsoft have decided to get rid of the support for the Skype Desktop API.
https://blogs.skype.com/2013/11/06/feature-evolution-and-support-for-the-skype-desktop-api/
I'm not exactly sure what that means for skype4py.
Upvotes: 0
Reputation: 1
4 Years later. I just want to mention that the arguments have probably changed in the latest versions of Skype. Meaning that the code below:
try:
CmdLine = sys.argv[1]
except:
print 'Missing command line parameter'
sys.exit()
(which is a line from the Example Skype4Py script "callfriend.py" from github) will just give you the exception. I don't know what has changed, since 2 years ago I didn't use the Skype4Py but the argument sys.argv[1] isn't the send command anymore. Basically you ll get that sys.argv[1] is ouy of range. What you can do now is basically this:
import Skype4Py
skype = Skype4Py.Skype()
skype.SendMessage('receiver's skypename','your message text')
And if you want to call a contact just use the code bellow.
skype.Placecall('skypename')
Upvotes: -1
Reputation: 76955
Should work based on the docs.
from Skype4Py import Skype
import sys
client = Skype()
client.Attach()
user = sys.argv[1]
message = ' '.join(sys.argv[2:]
client.SendMessage(user, message)
Usage:
$ python message.py someuser This is my message
You better not use this to spam people :D
If you need to do anything further with this, you better learn Python. For educational purposes, here's a line by line breakdown:
sys.argv[2:]
), using a space as a separatorUpvotes: 10