Jump to content

Alfred to Skype Interaction


Recommended Posts

Last but not least: Skype! Send messages directly with alfred and call users. You no longer need to use your mouse to chat in skype ;)

TwDnafY.png

Skype needs to be running for this to work. You should receive a warning from skype, that a programm wants to access its data - accept.

Commands:
s - autocompletion from skype contact list, then send message. Also displays last received message.
sc - autocompletion from skype contact list, call users.
snew - the 5 newest messages, simply select one for reply.
sr - reply to last user.

There is a Contact Action for using the alfred contacts to call skype, simply create a new Contact Action as described here http://support.alfredapp.com/workflows:config:triggers-contact-action and select "Call Skype", if you have saved skype usernames in your contacts as well, they should work too.

There's also a python equivalent (PyFred) of the PHP Workflows-Script, for those who <3 python over php.
Rather use this: No need to reinvent wheels ;)http://www.alfredforum.com/topic/403-alp-a-python-workflow-module/

 

Requirements:

Alfred, Skype, Python (preinstalled in OSX)

 

Download:
http://d.pr/f/cimZ

 

Known Issues:

- When you hit enter too fast, a few letters can be cut off. I have optimised what is possible to remedy this, to completely remove it, a feature change in Alfred is necessary. Simple fix, add a space after your message.


Wishlist/TODO: (decreasing importance)

- Filter empty Messages. (i.e. if they contained call information that is filtered already)

- Find user image

- sr without autcomplete

- Display status for the users with icon (maybe, if you know a good way to compose images without using libraries that need installation let me know...)

- Global user search and add
- More sanity checks: Was update successful, if it fails, why? etc.
- Clean XML replies from Smilies code etc.

- sr - directly reply to last person. 

- alt opens the chat window. (can't switch current window, but bring skype to front)

- Call skype # from adress book.

Changelog:

v0.3 (http://d.pr/f/cimZ)

- sr now directly replies, without autocomplete

- fetches all user images completely

- shows user status on search, snew, etc.

- buxfixes for encoding, snew, ...

- more caching, faster response.

 

v0.2 (http://d.pr/f/FcIO)
- Display the history of a chat when replying.
- New Command sr, to directly reply to a user.
- If you use sc with an unknown username or directly a phone number, it suggests calling as well as updating the friends list. (must have accidentially removed this, will be back.)
- Encoding works properly v2 ;)
- Open Skype with alt/enter.

v0.1.1 (http://d.pr/f/RGTo)
- Skype startup bug removed
- More debugging
- Encoding works properly
- snew for newest messages
- Contact Action to allow calling from contacts.
v0.1
- Initial release

License:
CC BY-SA 3.0
Any feedback or bug reports are highly appreciated!

Edited by xtin
Link to comment

I almost feared it won't work from scratch :) Updating cache takes at most a few seconds.

 

To troubleshoot:

- was skype open? (it needs to be)

- did you receive a warning from skype that a program tries to access it?

- did you receive a notification that it updated the contacts?

Link to comment

Same things happens to me.  Skype is open.  I received a warning from skype that a program wanted access - I clicked allow always, I did not receive a notification that it updated the contacts.

 

 

A nice companion to the Adium workflow!

 

However, after doing the 'skype update to cache contacts', I still can't start a conversation or call:

 

For 's' command, it just says 'Searching Friends' ... this is a good 10 minutes since I supposedly updated the cache:

 

skitch.png?resizeSmall&width=600

Link to comment

I am also having problems. 'Use skype update to cache friends' places a call in skype that connects forever without anything happening. No prompt to allow anything. 

 

Also wanted to say that this is going to be one of my absolut favorite workflows!! It would also be great to have some mechanism to quick reply to the last received message. Right now it looks like I will have to search for users whenever I write a message. It would be great to have a 'reply to last received message' command possibly showing the last chat messages in Alfred.

Link to comment

And maybe as a small addition to your workflow: A have a contact action that is connected to script with the code below. It allows you to call people from the contact detail list.

 

 

# code from Brett Terpstra
number=`echo {query}|sed 's/[\(\)\+ \-]//g'|sed 's/^1//'|sed 's/^/+1/'`
osascript -e "tell application \"Skype\" to send command \"CALL $number\" script name \"CLIDIALER\""
Link to comment

@greg i like the idea, added it to the wish list. 

 

Can you try deleting the extension and reinstalling it? (it will clear the corrupted database) 

 

Edit: I just checked, this should solve the issue. Problem is, that my script doesn't wait for approval, gets no contacts back, writes them to file and  then restoring the empty file crashes the script ... will upload an update in a sec.

Edited by xtin
Link to comment

Works perfectly! love it! It's my new favorite workflow.

 

Here are some more suggestions and one small bug:

1) When I am sending a message to a contact (both with s and snew) I can see the last message in that conversation. Why not the last 5-9 messages in this conversation (including the ones I sent by myself) 

2) Sometimes see what seems like the markup used by skype such as 

DATE <ss type="yes">(y)</ss>

or

DATE <partlist alt=""> <part identity="..."> <name>...

I can't really pin down when exactly right now but I will let you know when I manage to do that. For the second one, the most recent thing was a call.

3) I really like 'snew' but it still would be great to have an slast or something which skips the step of showing the last of last conversations and instead opens the last conversation with the most recent message right away. 

Link to comment

Hi, 

 

Cool you like it :)

 

to your suggestions:

1) Alfred allows only for single line subtitle per entry, therefore it doesn't really make sense to load more. Loading the last one the chat partner sent instead of the last message that has been sent at all is just a choice I found more comfortable, but I could easily change that if you find it more intuitive. 

2) Yes, that is how Skype saves its data, I could filter it out by simply stripping html-tags, so far I chose to keep it, because actually displaying the icons etc is not possible and filtering might have unintended side effects, but I will strip it in the next release as I find it ugly myself ;)

3) ok, do you want it to actually open the skype chat or just send a message to that user? How about with alt+enter it sends the message and opens the corresponding chat? 

Link to comment

1) I was thinking about displaying the most recent messages as multiple feedback items not as multiple lines in one feedback item. When I type 'snew', I get a list of recent messages from different people. You could use the same approach for the recent messages in the conversation with a particular person using my own picture for messages I sent. Does that make sense?

 

I would look something like this:

 

(friend icon) Yes, let's go that

(my icon) What's about coffee tomorrow morning?

(friend icon) How are you today?

 

I omitted the subtitle just for the example. For conversations, I would actually show the content of the message in the title and the date in the subtitle because the user name already is the query field as 'snew username:'. For the results in 'snew', I would continue to show the user name as the title.

 

 

3) I was thinking about typing 'slast' or something and the most recent conversation pops up in the style I describe in 1. So I type 'slast', Alfred retrieves the most recent conversation (maybe changing the search field to 'slast username:' automatically), and I can send a message in that conversation directly from alfred replying to the last received message without ever opening Skype.

Link to comment

After using your workflow for some more time, I came across another thing: 'snew' seems to let Alfred sort the messages so that the most frequently used ones are on top. I think it would make sense to sort them by date. You can do that with random UIDs (e.g. "my.workflow.result.[randomuid]"). Here is a discussion about this: http://www.alfredforum.com/topic/1332-alfred-v2-not-honoring-xml-order-in-script-filter/?p=6544

This is particular useful if you still plan to show multiple messages in a conversation so that they are sorted correctly by date.

Link to comment

Awesome! This is really great!

 

Here are some small little things I realized:

- The conversation does not seem to include my own picture. Only the one from the person I am talking too. I get the Skype icon.

- I saw a number of empty messages and I think they show up when the last part of a conversation was a phone call. Is that possible? I would change that either to informations about the call (duration with call icon) or just remove these rows.

- For `sr`, I think it would be better if you show the conversation right away without waiting for the user's confirmation. Currently, the user has to type 'sr', press enter (which complete the name), then the conversation show up and s/he can type. Maybe you can show the conversation right away without the enter step. But I am not sure about this. Would have to try.

 

Great work! I will use this tomorrow all day and let you know when I come across something else.

Edited by LeChuck
Link to comment

Quick little bug - when trying to send the word "Alfred" in a message, it only sends "Alf"

Unfortunately this is an alfred limitation, see here: http://www.alfredforum.com/topic/1416-incomplete-query/ and my feature request here: http://www.alfredforum.com/topic/1470-send-the-content-of-the-input-line-from-scriptfilter-to-the-next-step-as-input/ - if you want to support it, maybe +1 it ;) - I tried to minimize it as much as possible by caching the query from skype the first time it is made and then simply return it from file. You can "remedy" it, by waiting half a second before hitting enter.

 

Awesome! This is really great!

 

Here are some small little things I realized:

- The conversation does not seem to include my own picture. Only the one from the person I am talking too. I get the Skype icon.

- I saw a number of empty messages and I think they show up when the last part of a conversation was a phone call. Is that possible? I would change that either to informations about the call (duration with call icon) or just remove these rows.

- For `sr`, I think it would be better if you show the conversation right away without waiting for the user's confirmation. Currently, the user has to type 'sr', press enter (which complete the name), then the conversation show up and s/he can type. Maybe you can show the conversation right away without the enter step. But I am not sure about this. Would have to try.

 

Great work! I will use this tomorrow all day and let you know when I come across something else.

 

Glad you like it, i'm really eager for every bug you can find!

 

- This is known and not done so far from my laziness. I added it as a request (now i feel it's important, so i will do it :P)

- Indeed, the empty messages are calls. Essentially Skype stores that information as an XML and I simply filter out any tags. I'll add a check to remove such empty messages, or maybe I can exclude them in the db query already.

- Another token of my laziness, this way I could just reuse the code for snew by limiting the number of returned people to one, but you're right, it should be done differently, it started to annoy me too. (btw: you can also use tab for autocompletion, more intuitive for me as a coder) 

Link to comment

edit: After installing the current version everything works like a charm. Thanks for that! :)

 

edit2: One small bug i noticed. Sometimes the message gets cropped. See the screenshot:

 

https://dl.dropbox.com/u/7616878/croppedmessage-screen.png

 

Best regards

m0mo

 

puh, good to know it works well on 10.6 then :)

 

The cropped message is a known problem, i try to mediate it by caching as much as possible, you can avoid it by taking a breath and then hitting enter ;)

Link to comment

There is a new version mit many new exciting features ;) Please let me know if it works. Especially since I'm using PIL now for image processing, it would be great if so could let me know if it works out of the box with user images for him.

 

Cheers!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...