Can A Button Be Used In A HTML Pop-up To Perform A Task

575 views
Skip to first unread message

Paul Luckett

unread,
Jan 11, 2015, 12:38:29 AM1/11/15
to tas...@googlegroups.com
I think I have a rather simple and straightforward query. It is my understanding of the documentation that JavaScript can be used to call another Tasker task using performTask. I've got an HTML pop-up with a button that I'm attempting to call a task with. But when I click the button, I do not get output of any kind; not an error or any action.

To test, I created a simple Javascriplet action that calls the task and I can run it without issue. I've included a snippet of the code I'm using below. I've tried both performTask and tk.performTask. Please tell me if I'm missing something.

               
               
    <html>
    <script src='Tasker.js'></script>
    <script lang='JavaScript'>
        // user clicked the button
        function buttonClicked() {
          performTask('Run - Tweet clip');
    }
     
    </script>
          <body>
            <input id="Button1" title="TweetIt" type="button" value="TweetIt" onclick='buttonClicked();'/>
          </body>
    </html>

               

Thanks,
Paul

Paul Luckett

unread,
Jan 11, 2015, 8:56:25 PM1/11/15
to tas...@googlegroups.com
I figured it out and will share in a post tomorrow how I used a simple JavaScript script and HTML to call / execute / perform another Tasker task from an HTML Popup scene. I'll also do a full write-up and post more detail about how I'm using the action on technojudo.com.

Until then,
Paul

Paul Luckett

unread,
Jan 12, 2015, 5:37:51 PM1/12/15
to tas...@googlegroups.com
I'm really just getting into using Tasker scenes and I was curious if I could launch a task, any task, using HTML. Here's the code that worked for me to start a Tasker task from within a HTML popup using an HTML button element and Javascript:

    1. <html>
    2. <script src='Tasker.js'></script>
    3. <script lang='JavaScript'>
    4.     // user clicked the button
    5.    function buttonClicked() {
    1.         var ok = performTask('ExactNameOfTask','10','','');     
    2.         var ok = destroyScene('HTML Popup');
    3.         exit();
    4.  }
    5. </script>
    6. <body>
    7. <input id="Button1" title="Click Here" type="button" value="Click Here" onclick=' buttonClicked();'/>
    8. </body>
    9. </html>



    On Saturday, January 10, 2015 at 11:38:29 PM UTC-6, Paul Luckett wrote:
    Reply all
    Reply to author
    Forward
    0 new messages