Javascript and the SAY command

588 views
Skip to first unread message

Danielo515

unread,
Jul 16, 2014, 11:28:47 AM7/16/14
to tas...@googlegroups.com
Hello guys,

I'm doing some heavy weight JavaScript development with tasker and I'm finding some problems. One of them is with the say command. The documentation says that the script will wait until the say command finishes. This seems to be true. In fact the UI becomes unresponsive while the say command is being executed. How can I avoid that? 

I'm having other problem with the say command. I have some kind of loop where a function calls a function which calls again the first one if there are items left in an array. This should update the UI on every execution. If I don't execute a say command after the call to the second function, it works flawesly, but if I use a say command in between it works except for the UI update.

Schema:

FuntionA ----> Function B (say)-------> Function C (update ui)---- if items left in array-----> FunctionB (say)

Function B is the one that executes the say command. If the flow is only A ---> B ----> C the UI is updated, but if it is in in a loop like above, it only executes the say commands. WHY?

Here is the function B

    //reads the current feed and call the callback function if exists. 
    //the callback function receives if a next item exist 
function sayCurrentFeed(callback){
var item = currentFeed[currentItem],
text = item.title + composeBody(item.content,item.description);
        say( text ,"com.google.android.tts", "spa-esp", "media", 7, 5);
        
        if(callback)
            callback( currentItem < currentFeed.length);
}

Wietse van Buitenen

unread,
Jul 16, 2014, 1:51:58 PM7/16/14
to tas...@googlegroups.com
does it always perform the say command when it's in a loop or only once?

Jeremy Harris

unread,
Jul 16, 2014, 9:48:05 PM7/16/14
to tas...@googlegroups.com
The documentation says that the script will wait until the say command finishes. This seems to be true. In fact the UI becomes unresponsive while the say command is being executed. How can I avoid that?

I don't know java, so I'm not sure if this is at all useful, but in a regular Tasker say action, you can check the box next to Continue Task Immediately, to avoid that, I think. I could be wrong, but hopefully it helps.

Danielo515

unread,
Jul 17, 2014, 1:02:19 AM7/17/14
to tas...@googlegroups.com
Bello everybody ,

Yes, The say action is performed several times. Until end of the array or tasker crashes,which is pretty common.

I will investigate the continue task option, but I want the script to wait until the say command has finished,so I don't think that could be useful.

Hope anyone could throw some light on this topic.

Danielo515

unread,
Jul 18, 2014, 1:34:40 AM7/18/14
to tas...@googlegroups.com
Nobody has a clue?

Running the say command from an "external" task works. Seems like the say is too much for javascript taste. Can pent confirm this?

Wietse van Buitenen

unread,
Jul 18, 2014, 2:42:21 AM7/18/14
to tas...@googlegroups.com
I'm also using quite some JS and it all works fine.
I don't use much of the Tasker built in actions though..

I do have one where I set text of an Element in a Scene and in combination with a running Task that loops (with Wait & GoTo) this seems to hang somewhere.
Pent thinks it's a timing issue somewhere and is looking into it.
Perhaps this is something similar..

Danielo515

unread,
Jul 18, 2014, 3:11:13 AM7/18/14
to tas...@googlegroups.com
I don't think this is a similar problem.

In the original setup I didn't rely on external task, I just execute the say action from the JS code. And after a couple of say actions the whole tasker goes down. I would like to see what pent thinks about this.
Reply all
Reply to author
Forward
0 new messages