Giter Site home page Giter Site logo

Comments (8)

Surrogard avatar Surrogard commented on July 24, 2024 1

+1 from me
I use the plugin with automate and the only way currently to get things back is via broadcast or external file which works but is quite annoying to set up.

from termux-tasker.

Archenoth avatar Archenoth commented on July 24, 2024 1

Oh, agreed!

The ability to allow returning data from Termux into Tasker would mean that you can do things like tell if your scripts actually succeed, let you get processed data directly into Tasker tasks, or return state that only Termux can see.

So this comment isn't basically just a "+1", I'll try to explain the impact this has; without this functionality, the ways to return data to Tasker involve either:

Writing files to Tasker-readable locations

Since it's easier to explain by showing what things look like practically, let's dive into creating a scene with three checkboxes that are set with simple checks in Termux!
Service control popup with a few checkboxes indicating if certain services have started or not

First, to get the status of each service, you need to either write a new script, or add a hack to an existing script to write to a folder that Tasker can read. In this case I opted for a hack in my service script.

Then after implementing that, in order to read the result, the Task itself needs to perform the checks for each file (Easier in this case), or extract all the data from one file:
The Tasker Task to open the above box, and set the state of the checkboxes

The end result is, voila! I have 3 checkboxes on this scene that are checked based on if a service is started or not!

So, while it's not impossible, the ability to read the status code of tasks would be a really welcome for situations like this.

Sending an intent

This requires setting up a new Tasker profile for every single variable you wish to pass back that you wish to do something based on. So if I wanted to create a Task that ran a command, and if the result matched something to run another Task, that would involve:

  1. Setting up the Task to run the script
  2. Writing the script which would do the check, and then run the shell command:
am broadcast --user 0 -a net.dinglish.tasker.the-thing-I-want-to-send -e message "$something"
  1. Make a Tasker profile to react to the net.dinglish.tasker.the-thing-I-want-to-send intent and set it to a global variable, or to do the rest of the Task started in the Task started in Step 1

You would need to do this for every single communication between Tasker and Termux--so for something with 5 checks, that would involve making at least 6 profiles that do nothing but react to intents to continue your logic.

So again, while this is not impossible, it takes a pretty reasonable amount of extra effort.

Anyway, hope this explains what we are up against here..! I think this suggestion would be highly appreciated, so I wrote this up in hopes to give it a little more than just a simple "me too".

But even if this suggestion is declined, thanks for the project! It's extraordinarily useful~

from termux-tasker.

Archenoth avatar Archenoth commented on July 24, 2024 1

Yays! I'm happy I could help~

from termux-tasker.

ieatacid avatar ieatacid commented on July 24, 2024

I concur on the usefulness of this request.

from termux-tasker.

spaceman5 avatar spaceman5 commented on July 24, 2024

I am glad other people need it too..
I hope the creators of Termux will notice this thread, and update the Termux Tasker plugin..

from termux-tasker.

Archenoth avatar Archenoth commented on July 24, 2024

Hm, looking into it, it seems like adding this requires a bit more work than just updating this plugin.

Specifically, it looks like it requires an update in the main app to return those three values from the Service that handles the Intent here.

I'm not really an Android dev, so I'm not sure about the best way to do that.

from termux-tasker.

verboze avatar verboze commented on July 24, 2024

I look forward to seeing Archenoth's PRs merged! I started offloading more complex Tasker logic to Termux, and it is becoming apparent how much this feature is needed.

from termux-tasker.

fornwall avatar fornwall commented on July 24, 2024

The PR of @Archenoth (great job!) has been merged and released in version 0.4 of the Termux:Tasker app.

Note that this also requires version 0.86 of the main Termux app - this will be released within a day.

from termux-tasker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.