Skip to content

Instantly share code, notes, and snippets.

@whiteinge
Created January 1, 2013 20:03
Show Gist options
  • Select an option

  • Save whiteinge/4429633 to your computer and use it in GitHub Desktop.

Select an option

Save whiteinge/4429633 to your computer and use it in GitHub Desktop.
A Tasker task for texting a driving time estimate between your current location and home. Expects two variables to be set: HOME: An address, zip code, etc to use as the destination address when querying the Google Maps API. HOMENUM: A phone number to send the text to.
<TaskerData sr="" dvi="1" tv="1.3.3u2m">
<Task sr="task2">
<cdate>1345254133188</cdate>
<edate>1357068354779</edate>
<id>2</id>
<nme>Headed Home</nme>
<pri>10</pri>
<Action sr="act0" ve="3">
<code>902</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="100"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act1" ve="3">
<code>118</code>
<Str sr="arg0" ve="3">maps.googleapis.com</Str>
<Str sr="arg1" ve="3">maps/api/directions/json</Str>
<Str sr="arg2" ve="3">origin=%LOC
destination=%HOME
sensor=false</Str>
<Str sr="arg3" ve="3"/>
<Int sr="arg4" val="10"/>
<Str sr="arg5" ve="3">text/plain</Str>
<Str sr="arg6" ve="3"/>
</Action>
<Action sr="act2" ve="3">
<code>129</code>
<lhs>%HTTPL</lhs>
<op>4</op>
<rhs>0</rhs>
<Str sr="arg0" ve="3">var t = JSON.parse(global('HTTPD'));
var dur = t.routes[0].legs[0].duration.text;
var dist = t.routes[0].legs[0].distance.text;
var msg = "I'm in the car. Headed home.";
if (dist) msg += " I'm " + dist + " away.";
if (dur) msg += " With an estimated " + dur + " driving time (not accounting for traffic).";
var ok = sendSMS(global('HOMENUM'), msg);
flashLong("Sent message: " + msg);</Str>
<Str sr="arg1" ve="3"/>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="45"/>
</Action>
</Task>
</TaskerData>
@j0be

j0be commented Jul 12, 2021

Copy link
Copy Markdown

I'm getting an auth error.
Screenshot_20210712-182421

@micmusic85

micmusic85 commented Apr 8, 2022

Copy link
Copy Markdown

It's also not working for me. Has anyone managed to get this working again or found an alternative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment