Interact with Tasker like a plugin with just one action.

sampleuserhere

Active member
!WARNING LONG POST!

Tasker recent beta updates introduced a new feature that allows Tasker to act as a local server. We could utilize this one to make Tasker behave like "a plugin" by querying HTTP Request to Tasker's local server.


Look at this screen record.



In this Macro, I created a database, ran the following queries and returned the result.
Code:
[0]: CREATE TABLE IF NOT EXISTS test (name TEXT, number NUMERIC)
[1]: INSERT INTO test VALUES ("one","1"),("two","2")
[2]: SELECT * FROM test


What's the benefit of this method?
  1. You can receive the feedback directly.
  2. The feedback data size and type practically has no limit.


Macro
TaskerCenter.category
The category contains required tasker project too so the size is pretty big, it's still around 100kb though. I provided some sample macros for you all to play around too.



How to set up
  1. Run #1 Use this macro to import Tasker Project macro after importing the category.
  2. Download the latest Tasker beta, either by selecting direct download or grabbing the apk manually via reddit. You could always go to playstore too.
  3. Back to step 1 and select Import required tasker project.

Testing
  1. Run each available macros by testing the empty trigger. Tap Empty Trigger > Test Trigger.
This is the available premade tasks to run tasker action in the project. I left several description as well in their respective macros.
  1. convertText encodes and decodes text to URL and base64 or create digest md5 or sha1.
  2. runShell runs equivalent of Shell Script via Tasker. +accepts multiline without escaping newline with \n.
  3. screenInfo queries screen information as Assistant, requires write secure settings permission.
  4. simpleMatchRegex runS equivalent of Text Replace > Extract Text. +You can generates arrays from the group.
  5. sqlQuery runs SQL query against a database file.


How to use

[1] Macrodroid

runTask
  1. Run Post query to
  2. You can pass the variables as query parameters.
    1. Pass task_name parameter to pass the name of the task you want to run.
    2. Any additional variables can be passed too, the parameter names will be the name of the variable. Tasker variable has different naming rules than Macrodroid's, they have to be a minimum of 3 characters lower alphabet and underscore so only parameters that fits those rule will be converted into variable.
  3. Store the result to a string variable then use JSON parse action to parse it.

action
This is used to run task with name prefixed with "action: ".
  1. Run Post query to
    1. Say, the task name is action: readFile, the URL should be
  2. Additional variables can be passed to, follows the same rules as stated in runTask.

[2] Tasker

runTask
  1. Add Return action at the very end of your task, check out Local variable Passthrough and Replace on Passthrough options.
action
  1. Add Perform Task action to perform a task named Quick Feedback. check out Local variable Passthrough option.


Event
Undoubtedly, Macrodroid has many more triggers than Tasker, however there are a few triggers that are only available in Tasker and not in Macrodroid. Such as.
  1. File trigger
  2. Call screening
  3. Tick event
You can take a look at the sample event in Tasker and Macrodroid event macro to see how to set it up.


End note
Still not that friendly, but IMHO it's a better approach than using intent or shortcut. You can grab some more frome r/tasker or taskernet to test this setup. This method is also not limited to Macrodroid, it works for every app or any local client that can query HTTP Request.

Lemme know if you got any question. Hope you guys find this useful :)
 

Attachments

  • TaskerCenter.category
    110.8 KB · Views: 7
Top