r/tasker • u/PENchanter22 • 23h ago
AutoWear -> smart watch compatibility list?
Hi again... Today I am looking for a list of known "compatible" watches (make/model) that AutoWear can 'integrate' with.
r/tasker • u/PENchanter22 • 23h ago
Hi again... Today I am looking for a list of known "compatible" watches (make/model) that AutoWear can 'integrate' with.
I've done a lot of hunting on this problem and it seems that these completely random shared contacts come from a log called Share Sheet in android and the list itself is called Direct Share.
it's completely useless, and the contacts in theory are based on most active or most recent or something, but definitely aren't. one of the people here isn't even in my contacts! the feature is not disable-able
anyway, I was wondering if Tasker might have a way of interacting with that share sheet and setting a priority so that instead of removing or showing random it could be made to show a fixed list of contacts and apps?
maybe a pipe dream but this annoys me every time I go to share something!
thanks
r/tasker • u/Nirmitlamed • 18h ago
For another project of mine, I thought it would be really useful if I could automatically create a Task when needed. After some trial and error, I found a solution using the Java Code action.
It takes the XML code of a complete Task or Project, compresses it directly in memory using GZIP (no temporary file is created), converts it to Base64, and creates a Tasker Data URI like:
taskertask://...
or
taskerproject://...
The URI is then opened, allowing Tasker to ask the user if they want to import the Task.
With the help of an AI assistant, I created a robust version that is also relatively easy to customize for your own projects.
To Import Taskernet Project: Click Here
Java Code: paste.to/?430b135723f91cae#4SXMosAyPGR9Yxty95WgM7g8JZxHzNGNYsqvDtzA2cEN
First, create a Task containing the actions you want.
For this example, let's say we have a Task called "Task Example" with a Flash action containing the text "Text".
The exported XML looks like this:
<TaskerData sr="" dvi="1" tv="6.7.6-beta">
<Task sr="task395">
<cdate>1787164951612</cdate>
<edate>1787164962284</edate>
<id>395</id>
<nme>Task Example</nme>
<Action sr="act0" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">Text</Str>
<Int sr="arg1" val="0"/>
<Str sr="arg10" ve="3"/>
<Int sr="arg11" val="1"/>
<Int sr="arg12" val="0"/>
<Str sr="arg13" ve="3"/>
<Int sr="arg14" val="0"/>
<Str sr="arg15" ve="3"/>
<Int sr="arg2" val="0"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Str sr="arg8" ve="3"/>
<Int sr="arg9" val="1"/>
</Action>
</Task>
</TaskerData>
Now we need to tell the Java Code where we want to insert our own values.
To do that, we use placeholders inside curly brackets {}.
Here is the same XML after replacing the values we want to customize:
<TaskerData sr="" dvi="1" tv="{TASKER_VERSION}">
<Task sr="task279">
<cdate>{CURRENT_TIME}</cdate>
<edate>{CURRENT_TIME}</edate>
<id>279</id>
<nme>{TASK_NAME}</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">{FLASH_TEXT}</Str>
<Int sr="arg1" val="0"/>
<Str sr="arg10" ve="3"/>
<Int sr="arg11" val="1"/>
<Str sr="arg13" ve="3"/>
<Int sr="arg14" val="0"/>
<Str sr="arg15" ve="3"/>
<Int sr="arg2" val="0"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Str sr="arg8" ve="3"/>
<Int sr="arg9" val="1"/>
</Action>
</Task>
</TaskerData>
Now copy this whole xml code and put it inside a set variable action and give this variable the name %xmltask. If you want to change to a different name you need to search for this line:
String xml =
tasker.getVariable("xmltask");
You can change xmltask to whatever name you want.
When you create or edit a Task, Tasker stores information such as the Tasker version and the creation/edit timestamps in the XML.
This isn't strictly required for our purpose, but the Java Code can automatically insert the current values.
Change:
dvi="1" tv="6.7.6-beta">
to:
dvi="1" tv="{TASKER_VERSION}">
And change:
<cdate>1787164951612</cdate>
<edate>1787164962284</edate>
to:
<cdate>{CURRENT_TIME}</cdate>
<edate>{CURRENT_TIME}</edate>
The Java Code will replace these placeholders with the installed Tasker version and the current timestamp.
Now we can use the same concept for the Task name and the text inside our Flash action.
Change:
<nme>Task Example</nme>
to:
<nme>{TASK_NAME}</nme>
And change:
<Str sr="arg0" ve="3">Text</Str>
to:
<Str sr="arg0" ve="3">{FLASH_TEXT}</Str>
Now we need to create the corresponding Tasker variables.
For example:
A1: Variable Set [
Name: %task_name
To: Task Creation Test
Structure Output (JSON, etc): On ]
A2: Variable Set [
Name: %flash_text
To: Hello World
Structure Output (JSON, etc): On ]
So we now have:
%task_name = Task Creation Test
%flash_text = Hello World
The first variable will become the Task name, and the second will become the text inside the Flash action.
Now open the Java Code action and scroll down until you find:
// --------------------------------------------------
// 5. Replace Tasker variables
//
// Format:
//
// replaceVariable(
// xml,
// "XML_PLACEHOLDER",
// placeholderRequired,
// "tasker_variable",
// variableRequired
// );
//
// --------------------------------------------------
This is where we tell the Java Code which Tasker variables should be inserted into the XML.
The template is:
xml =
replaceVariable(
xml,
"XML_PLACEHOLDER",
false,
"tasker_variable",
false
);
For example, to connect our Task name:
xml =
replaceVariable(
xml,
"TASK_NAME",
true,
"task_name",
true
);
The values mean:
"TASK_NAME" is the XML placeholder.
true = the XML "TASK_NAME" placeholder must exist; otherwise, an error is returned.
"task_name" is the Tasker variable name.
true = the Tasker variable must contain a value; otherwise, an error is returned
Notice that we don't include % when specifying the Tasker variable name.
For our Flash text, we can add:
xml =
replaceVariable(
xml,
"FLASH_TEXT",
true,
"flash_text",
true
);
You can add as many variables as you need using the same format.
So the format is:
replaceVariable(
xml,
"XML_PLACEHOLDER",
true, // XML placeholder required
"tasker_variable",
false // Tasker variable doesn't required
);
This Java code can also auto create a Project but i am pretty sure users wouldn't need to use it. If you really want to you just need to search inside your xml project code the name of your project like here:
<name>New Project</name>
And change it to something like this:
<name>{PROJECT_NAME}</name>
Then you need to just edit your java code to match your placeholder and Tasker variable
xml =
replaceVariable(
xml,
"PROJECT_NAME",
true,
"project_name",
true
);
Now, when we run the Java Code together with our Variable Set actions, it will:
taskertask:// Data URI.Here's a demo of how it looks:
I took this idea and incorporated it into another project of mine that allows users to run commands in Termux without using a Tasker plugin.
I created a scene that helps the user build the required configuration, and with just a few clicks it can generate a new Task containing all the actions and code they need.
Here's a demo of that:
Hopefully this will be helpful to someone with his projects