Announcement

Collapse
No announcement yet.

New script feature for Tasker plugin.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    New script feature for Tasker plugin.

    Hi, I'm happy to announce that Tasker plugin now support script call to HS3.

    With scriptcall you can do much more than before, send any data to a script in hs3 and do what ever you want. There is also few callback functions that you can use from the script itself.

    When you upgrade to the latest HS3 Tasker 3.0.2.9 it will add a sample script myscript.vb in your script folder.
    PHP Code:
    'Simple demo code for tasker plugin.
    '
    Call the script from tasker withSet %HSCommand toscriptfilename|sub/function|data
    'Use the return to send back data to tasker.
    '
    Callback names that can be usedsaystatusaddressplaysoundreturnedstringreturnedvalue 

    Sub Main
    ()
    hs.writelog("MyScript","No data")
    End Sub

    Function SingleReturn(ByVal Parms As Object)
    hs.writelog("MyScript",Parms)
    Return 
    "say=Command executed with value " Parms 
    End 
    Function

    Function 
    MultiReturn(ByVal Parms As Object)
     
    hs.writelog("MyScript",Parms)
     
    dim strReturn as string ""
     'Use ; to separate multiple talkback commands.
     strReturn = strReturn & "playsound=wolves.mp3" & ";" '
    Soundfile has to be stored in soundfiles folder under tasker.
     
    strReturn strReturn "say=" Parms ";"
     
    strReturn strReturn "status=" Parms ";"
     
    strReturn strReturn "address=39.764339,-104.8551115" ";" 'Can be cordinates or location.
     strReturn = strReturn & "returnedstring=Hi, this is a response from HS3" & ";"    '
    Used to catch up string from HS3 to tasker so you can make some task arround the string.
     
    strReturn strReturn "returnedvalue=500" ";"     'Used to catch up string from HS3 to tasker so you can make some task arround the string.
     Return strReturn
    End Function

    Sub NoReturn(ByVal Parms As Object)
    hs.writelog("MyScript",Parms)
    End Sub 
    Tasker profiles is also updated so please use the app "Setup Tasker Files" and upgrade your Tasker profiles from the installation guide.

    New sample task is added in HS3 Samples
    Script_Multireturn
    Script_NoReturn
    Script_Simple_NoData
    Script_SingleReturn
    Last edited by tonlof; June 16, 2015, 03:59 PM.
    Please excuse any spelling and grammatical errors I may make.
    --
    Tasker Plugin / Speech Droid
    Tonlof | Sweden

    #2
    Great, thanks Tony.

    Comment


      #3
      Hi Tony,
      The plugin loads the script MyScript in the wrong folder.
      It's a minor spelling. Go to HS3 root folder and cut it out and past in the wright folder. The folders are close together. Just stumbled upon it when doing something unrelated.

      Thank you.

      Eman.
      TinkerLand : Life's Choices,"No One Size Fits All"

      Comment


        #4
        Originally posted by Eman View Post
        Hi Tony,
        The plugin loads the script MyScript in the wrong folder.
        It's a minor spelling. Go to HS3 root folder and cut it out and past in the wright folder. The folders are close together. Just stumbled upon it when doing something unrelated.

        Thank you.

        Eman.
        Hi Eman, thank you for reporting. It should now be fixed.
        Please excuse any spelling and grammatical errors I may make.
        --
        Tasker Plugin / Speech Droid
        Tonlof | Sweden

        Comment


          #5
          This is super good

          Best addition to the tasker plugin yet!

          Comment


            #6
            wait for return from script run function

            I have a script that was very intermittent returning a "say" value to tasker. In the script, I had a "hs.wait" command that was 4 seconds. The symptoms were that only about 20% of the time, tasker would "say" what I have returned from the script even though the script executed correctly. After quite a bit of troubleshooting time, I found that the 4 seconds was too long since it delayed the return of the "say" return string by 4 seconds and apparently the tasker %HSCommand function had given up. So what is the max time that script can execute before returning with a return string and be confident that the return value/string/command will be executed?

            Also, is there a way to lenghten this timeout time in those rare occasions that you need it?

            Comment


              #7
              Originally posted by jimbell View Post
              I have a script that was very intermittent returning a "say" value to tasker. In the script, I had a "hs.wait" command that was 4 seconds. The symptoms were that only about 20% of the time, tasker would "say" what I have returned from the script even though the script executed correctly. After quite a bit of troubleshooting time, I found that the 4 seconds was too long since it delayed the return of the "say" return string by 4 seconds and apparently the tasker %HSCommand function had given up. So what is the max time that script can execute before returning with a return string and be confident that the return value/string/command will be executed?

              Also, is there a way to lenghten this timeout time in those rare occasions that you need it?
              The timeout for tasker to grab data is set to 4 seconds. You can change this timeout in HS3Post on every line that have HTTP Get. But all changes will be overwritten when a update is ready. Could you use 3 seconds in your script?
              Please excuse any spelling and grammatical errors I may make.
              --
              Tasker Plugin / Speech Droid
              Tonlof | Sweden

              Comment


                #8
                3 seconds work great

                Yes, I can use 3 seconds in my script. Actually, I changed the wait time to 2 secs. The 4 seconds was arbitrary and 2 seconds works for me. I don't see any future need for a longer timeout, but you never know. It was just my luck that I chose 4 secs originally. The symptoms were that it would work some of the time (about 10%) and fail for all the other tries.
                Thanks for the quick reply.

                Comment

                Working...
                X