<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>glow.li: Tasker</title>
        <description>A blog by glow.</description>
        <link>https://glow.li/tags/tasker.xml</link>
        <atom:link href="https://glow.li/tags/tasker.xml" rel="self" type="application/rss+xml"/>
        <generator>Glow.li Builder</generator>
            <item>
        <title>Pass variables from Termux to Tasker</title>
        <description>&lt;p&gt;I figured out that you can pass variables from Termux to a Tasker task. This example sets Android's volume to a value specified in Termux.&lt;/p&gt;
&lt;h3 id="Step+1%3A+Creating+the+script" name="Step+1%3A+Creating+the+script"&gt;&lt;a class="hash-link" href="#Step+1%3A+Creating+the+script"&gt;Step 1: Creating the script&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;volume.sh&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#!/data/data/com.termux/files/usr/bin/sh
#am broadcast --user 0 -a net.dinglish.tasker.[task name] -e [variable name] "[value]" &amp;gt; /dev/null
am broadcast --user 0 -a net.dinglish.tasker.volume -e volume "$1" &amp;gt; /dev/null&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="Step+2%3A+Create+a+Tasker+profile" name="Step+2%3A+Create+a+Tasker+profile"&gt;&lt;a class="hash-link" href="#Step+2%3A+Create+a+Tasker+profile"&gt;Step 2: Create a Tasker profile&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/TaskerVolume1.webp?chash=Iebu8e88da" alt="Screenshot" title="Screenshot" class="right size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/TaskerVolume1.webp?chash=Iebu8e88da 1500w, https://glow.li/media/images/1200/TaskerVolume1.webp?chash=Iebu8ff9f6 1200w, https://glow.li/media/images/1000/TaskerVolume1.webp?chash=Iebu8ff9f6 1000w, https://glow.li/media/images/800/TaskerVolume1.webp?chash=Iebu8ff9f6 800w, https://glow.li/media/images/700/TaskerVolume1.webp?chash=Iebu87cd63 700w, https://glow.li/media/images/600/TaskerVolume1.webp?chash=Iebu8d6862 600w, https://glow.li/media/images/500/TaskerVolume1.webp?chash=Iebu889ab5 500w, https://glow.li/media/images/400/TaskerVolume1.webp?chash=Iebu8665b2 400w, https://glow.li/media/images/300/TaskerVolume1.webp?chash=Iebu808964 300w, https://glow.li/media/images/200/TaskerVolume1.webp?chash=Iebu89ec3d 200w, https://glow.li/media/images/100/TaskerVolume1.webp?chash=Iebu8264f8 100w" &gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a new profile&lt;/li&gt;
&lt;li&gt;Choose "Event"&lt;/li&gt;
&lt;li&gt;In the "Select Event Category" dialog choose "System"-&amp;gt;"Intent Received"&lt;/li&gt;
&lt;li&gt;As Action define &lt;code&gt;net.dinglish.tasker.volume&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This profile will now be called whenever it receives the "volume" intent.&lt;/p&gt;
&lt;h3 id="Step+3%3A+Create+the+Task" name="Step+3%3A+Create+the+Task"&gt;&lt;a class="hash-link" href="#Step+3%3A+Create+the+Task"&gt;Step 3: Create the Task&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;img src="https://glow.li/media/images/TaskerVolume2.webp?chash=Iebu824219" alt="Screenshot" title="Screenshot" class="right size-half" loading="lazy" sizes="(max-width:703px) 100vw, 750px" srcset="https://glow.li/media/images/TaskerVolume2.webp?chash=Iebu824219 1500w, https://glow.li/media/images/1200/TaskerVolume2.webp?chash=Iebu8c8317 1200w, https://glow.li/media/images/1000/TaskerVolume2.webp?chash=Iebu8c8317 1000w, https://glow.li/media/images/800/TaskerVolume2.webp?chash=Iebu8c8317 800w, https://glow.li/media/images/700/TaskerVolume2.webp?chash=Iebu870faa 700w, https://glow.li/media/images/600/TaskerVolume2.webp?chash=Iebu85c64d 600w, https://glow.li/media/images/500/TaskerVolume2.webp?chash=Iebu8a35f6 500w, https://glow.li/media/images/400/TaskerVolume2.webp?chash=Iebu81e763 400w, https://glow.li/media/images/300/TaskerVolume2.webp?chash=Iebu8034b8 300w, https://glow.li/media/images/200/TaskerVolume2.webp?chash=Iebu801974 200w, https://glow.li/media/images/100/TaskerVolume2.webp?chash=Iebu860c7e 100w" &gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Tap "New Task" and give it a name&lt;/li&gt;
&lt;li&gt;Tap + to add a new Action&lt;/li&gt;
&lt;li&gt;Choose "Audio"-&amp;gt;"Media Volume"&lt;/li&gt;
&lt;li&gt;Under "Level" tap the icon with the crossing arrows to switch to text mode.&lt;/li&gt;
&lt;li&gt;Enter &lt;code&gt;%volume&lt;/code&gt; as a value&lt;/li&gt;
&lt;li&gt;You need to exit Tasker for the changes to take effect.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="Step+4%3A+Run+the+script" name="Step+4%3A+Run+the+script"&gt;&lt;a class="hash-link" href="#Step+4%3A+Run+the+script"&gt;Step 4: Run the script&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can now run the script. It will send an intent to Tasker. It will put the first argument as new volume, which has to be an integer from 0-15.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;./volume.sh 4&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is only a simple example of what you can do with variables. Let me know what you come up with.&lt;/p&gt;</description>
    <pubDate>Sun, 03 Apr 2016 00:00:00 +0000</pubDate>
    <link>https://glow.li/posts/pass-variables-from-termux-to-tasker/</link>
    <guid isPermaLink="false">1459641600</guid>
</item>

    </channel>
</rss>

