Thanks for watching!
Another great plugin possibility would be IFTTT. A receiver/sender plugin to IFTTT would open up some seriously crazy oportunities, I.e. controlling home appliances or responding to them. I could accomplish what I needed with a Do button or Maker channel.
//This example shows how to receive data from other apps
//like 'Tasker' which allow sending of Android Intents.
//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
//Create a text label and text boxt.
txt = app.CreateText( "Intent Data:" );
lay.AddChild( txt );
txt1 = app.CreateText( "", 0.95, 0.6 , "left,multiline" );
txt1.SetBackColor( "#ff222222" );
txt1.SetTextSize( 18 );
lay.AddChild( txt1 );
//Add layout to app.
app.AddLayout( lay );
}
//Handle data sent from other apps.
function OnData( isStartUp )
{
//Display intent data.
var intent = app.GetIntent();
if( intent )
{
//Extract main data.
var s = "action: " + intent.action + "\n";
s += "type: " + intent.type + "\n";
s += "data: " + intent.data + "\n\n";
//Extract extras.
s += "extras:\n";
for( var key in intent.extras )
s += key+": "+intent.extras[key] + "\n";
txt1.SetText( s );
}
}
And the Tasker details:
This is the looping script. It flashes %BLUE for Bluetooth status so you know the Tasker has a working variable. Then it sends intent and loops:
https://goo.gl/photos/bZbbjecs41PSZQ1r6
Here are the actual intent details from Tasker:
https://goo.gl/photos/1Pmu1HE7Tem6JDVo7
https://goo.gl/photos/Q1DsRkeFCy6cjGpq9
https://goo.gl/photos/TvJdLWLHnqW6EqHo7
Here's a function (from my plugin) you might need to see the contents of [object Object]
// ******************************
// * showObjProp
// ******************************
// show obj properties. save to clipboard for later use
function showObjProp(obj) {
var ss=JSON.stringify(obj,null,1);
alert(ss);
app.ShowPopup('JSON object save to clipbaord for easy paste reference');
app.SetClipboardText(ss);
} // showObj(obj)
Thanks for the input, but I think there's a different issue. That [object Obfect] only pops up once the first time it's loaded. My Tasker script goes every five seconds. I don't believe that those values are being delivered from Tasker, otherwise the debug would show a continual value updated.
https://goo.gl/photos/5XoZCj1CypPm6Jq8A
With the extras, suppose I use message:%BLUE in Tasker, how should my code read in DroidScript to receive that?
I was looking for this because I had got about halfway done making Tasker write a file and getting DroidScript to read it when it opened with the simple App open of Tasker. I have about a hundred items, should I just put them in extra > JSON instead?