Created
January 1, 2013 20:03
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
I created both test variables accordingly, but it does not work. No errors are returned but nothing happens. Any ideas?
@duckredbeard It isn't necessary to use a % symbol in the global() function, it's optional.
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
Also note in that thread that I mentioned that I changed line 43 to be "%" before the HOMENUM so it would reference the variable.