Need a python script that uses skype4py to send an instant message

I installed skype4py. ( http://skype4py.sourceforge.net/doc/html/ )

I do not know python. I need a simple script example that takes the first argument of cmd as the username and the second argument as the message. this instant message should be sent to the skype username.

Does anyone know how to do this?

thanks in advance

+1
source share
4 answers

Must work based on documents.

from Skype4Py import Skype import sys client = Skype() client.Attach() user = sys.argv[1] message = ' '.join(sys.argv[2:] client.SendMessage(user, message) 

Using:

 $ python message.py someuser This is my message 

Better not to use this for spamming people: D

If you need to do something, learn Python better. For educational purposes, here is line by line:

  • Skype import class from Skype4Py
  • Import sys containing script arguments passed from command line to list of lines, argv
  • Create an instance of Skype, name it
  • Attach client to Skype Skype client
  • Give the user the option to send him to the second command line argument (first, this is the script name)
  • Construct a line (message) by sys.argv[2:] each line in the command line arguments after the third ( sys.argv[2:] ), using a space as a separator
  • Send a message to user
+11
source

I needed something like this - get a warning about some things from my ubuntu server (console only) via skype / CLI. Not enough python code above. I basically followed this guide so that everything worked: http://www.qxs.ch/?p=9

g'luck.

PS. hah, just noticed that I came across a JMW tutorial. good.

+1
source

4 years later. I just want to mention that the arguments probably changed in recent versions of Skype. This means the code below:

 try: CmdLine = sys.argv[1] except: print 'Missing command line parameter' sys.exit() 

(this is a line from the Skype4Py example script "callfriend.py" from github) will just give you an exception. I do not know what has changed since 2 years ago I did not use Skype4Py, but the sys.argv [1] argument is no longer a send command. You will basically get sys.argv [1] to be a range. Now you can do the following:

 import Skype4Py skype = Skype4Py.Skype() skype.SendMessage('receiver skypename','your message text') 

And if you want to call a contact, just use the code below.

 skype.Placecall('skypename') 
0
source

For new readers of YMMV .. Microsoft decided to get rid of support for Skype Desktop API.

https://blogs.skype.com/2013/11/06/feature-evolution-and-support-for-the-skype-desktop-api/

I'm not quite sure what this means for skype4py.

0
source

Source: https://habr.com/ru/post/906534/


All Articles