Script to send a gTalk message

2,416 views
Skip to first unread message

baudi

unread,
Oct 30, 2010, 3:59:40 PM10/30/10
to Tasker
I've written a script to send a Google Talk instant message from a
Tasker action. Here's a link that describes it.
http://tasker.wikidot.com/sendim

baudi

unread,
Oct 30, 2010, 4:15:28 PM10/30/10
to Tasker
Forgot to mention, if you are new to SL4A and scripting, take a look
at this wiki entry about using SL4A with Tasker.
http://tasker.wikidot.com/sl4a

Peter

unread,
Nov 10, 2010, 8:18:06 AM11/10/10
to Tasker
I want to create a widget that uses this script along with your
speechtoclip.py I don't know much about writing scripts so I was
wondering what you use to determine how long to record in the speech
script. Is there to allow a screen press on a widget to start and
stop recording?

On Oct 30, 3:15 pm, baudi <dch...@gmail.com> wrote:
> Forgot to mention, if you are new to SL4A and scripting, take a look
> at this wiki entry about using SL4A with Tasker.http://tasker.wikidot.com/sl4a

baudi

unread,
Nov 10, 2010, 10:03:23 AM11/10/10
to Tasker
It doesn't record speech. It uses the Android speech recognition
capability, which doesn't provide any mechanism to record what you
say. In other words, my script simply starts the Android speech
recognition function, and the next thing my script sees is the speech-
to-text transcription. Everything in between is hidden from me and
everybody else who uses the capability. The Android recognition
function uses its own algorithms to determine when to start and stop
based on what's coming through the microphone.

Matt R

unread,
Sep 6, 2012, 7:12:47 PM9/6/12
to tas...@googlegroups.com
Hi baudi,
 
I use your sendIM python script to send messages in GTalk via SL4A, but I've noticed that once I send one that way I no longer receive the notifications from the built-in GTalk app.  I would guess that Google is routing the messages I receive back to the SL4A client and not the built-in app (similar to how if you're chatting on a computer it doesn't usually send notifications to your phone too).  Have you found a way around this?  I tried adding a line to the end of the script to disconnect the client, but that didn't help.  I know you have another set of SL4A scripts that will wait and receive GTalk messages and pass them to Tasker, but I can already do that using %NTITLE in Tasker, so I'd rather not have to add that.  Any ideas?
 
Matt

baudi

unread,
Sep 6, 2012, 7:28:49 PM9/6/12
to tas...@googlegroups.com
I don't use my primary gmail account to send IM messages. I use a different gmail account for that. 

baudi

unread,
Sep 6, 2012, 8:53:05 PM9/6/12
to tas...@googlegroups.com
What's the point, you might ask, if I can't really get a response from whoever I send the IM to.

I actually use this to communicate with Homeseer on my home computer. I have it set up to receive IM messages and act on them. If it needs to tell me something (such as the driveway motion sensor was just triggered), it sends an IM to my main gmail account which I receive on my phone. The upshot is that I have three gmail accounts: one for sending messages from my phone, one for sending messages from Homeseer, and one for my main gmail account so that I can receive messages on my phone. 

If you are trying to use it to send an "I'm on my way home" message to somebody, and expect a response, I'm not sure how to do that. 

Matt R

unread,
Sep 7, 2012, 12:13:09 AM9/7/12
to tas...@googlegroups.com
I actually use it for responding to messages from the lock screen. Unfortunately, after I respond I won't get any more messages, meaning I end up having to unlock my screen anyway to open GTalk to establish the connection to the built-in app. I'll try a few more things to see if I can find a solution.

Matt

Matt R

unread,
Sep 8, 2012, 2:38:36 AM9/8/12
to tas...@googlegroups.com




Success! For anyone attempting the same, the wiki script needs two modifications. Change the last line from:

cl.send(xmpp.protocol.Message(IM_to,IM_text))

to the following two lines:

cl.sendInitPresence(requestRoster=0)
cl.send(xmpp.protocol.Message(IM_to,IM_text,typ='chat')

Seems to work!

Matt

baudi

unread,
Sep 8, 2012, 2:42:30 PM9/8/12
to tas...@googlegroups.com
That's great! Why don't you modify the script on the Tasker wiki? I certainly don't mind. In fact, that's what the wiki is for: to improve stuff.

Matt R

unread,
Sep 9, 2012, 5:24:38 PM9/9/12
to tas...@googlegroups.com
Done and done!

Matt

Matt R

unread,
Sep 21, 2012, 1:48:35 PM9/21/12
to tas...@googlegroups.com
Those warnings are normal.  I get those same messages on my phone, but the script works.  Maybe double check your username (including @gmail.com) and password?
 
Matt

Chris T

unread,
Sep 21, 2012, 2:09:02 PM9/21/12
to tas...@googlegroups.com
Thanks, the pass variables were differed from the defined variables displayed on the variables tab on the main screen.

Avi

unread,
Nov 3, 2012, 1:02:32 PM11/3/12
to tas...@googlegroups.com

Hi,
I have managed to use this successfully on my Android phone, but for some reason it's not working anymore.
When running inside a terminal I get warnings about two methods that were depreciated.
might this be the reason?

thank you

Avi

unread,
Nov 3, 2012, 1:21:00 PM11/3/12
to tas...@googlegroups.com

problem solved.
I sent it to myself so it didn't work.
once changing accounts, it worked.
thank you for the awesome script.
do you have the inverse script?
one that gets the talk message and puts it in a variable?

Matt R

unread,
Nov 3, 2012, 3:17:32 PM11/3/12
to tas...@googlegroups.com
There is a listener script you can use, I believe, but I find it much easier to just copy the notification text (%NTITLE) whenever a new message is received (using the notification event context as a trigger).

Matt

joaomgcd

unread,
Nov 8, 2012, 7:02:33 AM11/8/12
to tas...@googlegroups.com

Avi Levi

unread,
Nov 8, 2012, 7:54:45 AM11/8/12
to tas...@googlegroups.com
Thanks, but I am looking for something local, not based on any server.

rollingsr

unread,
Dec 15, 2012, 11:25:40 PM12/15/12
to tas...@googlegroups.com
Does it utilize a secure method for connecting?

Matt R

unread,
Dec 16, 2012, 2:46:30 AM12/16/12
to tas...@googlegroups.com
I Should say no, it's not very secure as you have to input your username and password in plain text.

Matt

Philipp Protschka

unread,
Jan 24, 2013, 10:21:03 PM1/24/13
to tas...@googlegroups.com
hey running into some problem maybe you can help me out:

followed the original instructions and set up gtalk accounts as well. downloaded the script from "http://tasker.wdfiles.com/local--files/sendim/sendIMupdated.py" and renamed it to "sendIM.py" to avoid confusion.

the problem is that my phyton script stops responding on my phone "unfortunately, SL4A has stopped" whenever i launch the task.

I have tried launching the script after the variables have been set and also removing the spaces between the variables see screenshots below.
any ideas what the issue could be...?



Philipp Protschka

unread,
Jan 25, 2013, 3:24:19 AM1/25/13
to tas...@googlegroups.com
Never mind! i found my (almost embarrassing mistakes)

1.) you must actually open the installed python apk and click install (--meh)
2.) Spaces behind usernames/password DO MATTER but are hard to see.

Björn Lindahl

unread,
Feb 25, 2013, 8:23:47 AM2/25/13
to tas...@googlegroups.com
Is it only me who get "Error: could not authenticate lately" when running the script? I have been running it previous but on my SGS 3 I can't get it to work. I've double checked my username/password and they seem correct. Any ideas are welcome.

Matt R

unread,
Feb 25, 2013, 12:05:02 PM2/25/13
to tas...@googlegroups.com
No problems here. What's changed between when it worked and now?

Matt

Bearcat M. Şándor - Feline Soul Systems

unread,
Feb 25, 2013, 4:15:23 PM2/25/13
to tas...@googlegroups.com
Do you perhaps have the dual authentication for google running? Most apps will no longer take your username/password combination after turning that on. You have to go into your account, click on "manage security" then look at your 2-step verification settings and get a password for Tasker.

I've not played with tasker yet, but i've been bitten by this scenario before. 




On Mon, Feb 25, 2013 at 10:05 AM, Matt R <matthew.r...@gmail.com> wrote:
No problems here. What's changed between when it worked and now?

Matt

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Bearcat M. Şándor
Feline Soul Systems
Voice: 872.CAT.SOUL (872.228.7685)
Fax: 406.235.7070
Jabber/xmpp/gtalk/email: bea...@feline-soul.net
MSN: bearca...@hotmail.com
Yahoo: bearcatsandor
AIM: bearcatmsandor
My public pgp key is attached for verification of my identity

Avi

unread,
May 23, 2013, 9:32:36 AM5/23/13
to tas...@googlegroups.com
Is this still working, or since they changes google talk to "hangouts" it doesn't?
I am unable to get it to send IMs anymore.

On Saturday, October 30, 2010 9:59:40 PM UTC+2, baudi wrote:

bdanders

unread,
May 23, 2013, 9:57:45 AM5/23/13
to tas...@googlegroups.com
Working fine for me right now, although I did see somewhere that the transition to hangouts has killed xmpp/jabber support, so I wouldn't expect it to work forever.

baudi

unread,
May 23, 2013, 10:50:40 AM5/23/13
to tas...@googlegroups.com
I just allowed Hangouts to replace Talk and it still works for me. Not sure if that will change. Not sure what to do if it does. 

bdanders

unread,
May 23, 2013, 10:55:30 AM5/23/13
to tas...@googlegroups.com
I have not converted to the new web UI yet on the account that I tested, so it's possible that might break it. I hope not.

baudi

unread,
May 23, 2013, 11:17:32 AM5/23/13
to tas...@googlegroups.com
I haven't either, because I read that doing so breaks the ability to make Google Voice calls from your computer. 

bdanders

unread,
May 23, 2013, 1:05:59 PM5/23/13
to tas...@googlegroups.com
Are you using the new web UI on your account, or just the new Android app?

On Thursday, May 23, 2013 11:41:12 AM UTC-4, Crew One wrote:
Unfortunately, the recent changes for google hangouts seem to have broken this. As of today, my IM's to myself don't come through anymore :( :(

Op zaterdag 30 oktober 2010 21:59:40 UTC+2 schreef baudi het volgende:

Avi Levi

unread,
May 23, 2013, 1:07:42 PM5/23/13
to tas...@googlegroups.com

both

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/IJPIMLaNFl0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.

baudi

unread,
May 23, 2013, 2:30:28 PM5/23/13
to tas...@googlegroups.com
Could you try switching back to the old web UI on your account (temporarily) and see if that restores the ability to send IMs?

Avi Levi

unread,
May 23, 2013, 3:02:27 PM5/23/13
to tas...@googlegroups.com
Tried it. It didn't work. I must be doing something wrong.
The send mail (via gmail) does work for me however.
I will try downloading the sendIM script again.


Avi Levi

unread,
May 23, 2013, 3:09:35 PM5/23/13
to tas...@googlegroups.com
I am getting a DeprecationWarning about the "sha" module.
Might this be the problem?

baudi

unread,
May 23, 2013, 4:00:44 PM5/23/13
to tas...@googlegroups.com
No. 

Has it ever worked for you? 

Avi Levi

unread,
May 24, 2013, 2:51:43 AM5/24/13
to tas...@googlegroups.com
Yes, of course.
I updated my firmware about a month ago, so it might be the reason, though I am doubtful.
I have an Xperia S, and updated it to the leaked Jelly Bean by Doomlord.


On Thu, May 23, 2013 at 11:00 PM, baudi <dch...@gmail.com> wrote:
No. 

Has it ever worked for you? 
Reply all
Reply to author
Forward
0 new messages