Generally the java side which executes the JS code would have to read the arguments and pass it as variable to your code. I'm not sure wether that's the case
I can use android commands like "am start" or more UNIX like comman's like dir /sys/img/* > /storage/emulated/0/download/xx.txt
I have written and called an android program com.photoresizer. I have hardcover a predefined target file and predefined resolution. It would be useful if I could set command line parameters.
The following is my example :
var infile = "/sdcard/download/.22.jpg";
function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
img1 = app.CreateImage( infile );
lay.AddChild( img1 );
img1.Hide();
var aw = img1.GetAbsWidth();
var ah = img1.GetAbsHeight();
var awah = (ah/aw) * 480;
if(aw > 480) {
img2 = app.CreateImage(null,480,awah,"px");
lay.AddChild(img2);
img2.DrawImage(img1,0,0,1,1);
img2.Hide();
app.AddLayout( lay );
img2.Save(infile);
app.Exit();
} else app.Exit( );
}
I am relatively new to DroidScript, but have experience with compiled languages.
It might be worth a try to set environment variables in your shell and see if they are available to app.GetEnv()
I really don't know whether that will work in your particular environment.
I am still learning droidscript and struggle with definition of function parameters, I don't think the documentation is complete enough. But I love the product, will stay a premium member for sure and will contemplate converting over in time. I have been running my entire business on visual CE since 2005, covered it to Droiddb and now have a few key programs written in droidscript.
I have 17 different relational databases in my current system with a number of different reports.
So I guess my next droidscript project will include a database. . .
I will also make a suggestion to add reporting capability to droidscript unless it already exists . . .