new version
//https://forum.processing.org/two/discussion/23999/detect-command-line-invocation-of-a-sketch
/**
* CommandLineDetect
* 2017-09-21 Jeremy Douglass - Processing 3.3.6
*
* Related forum discussions:
* - forum.processing.org/two/discussion/23999/detect-command-line-invocation-of-a-sketch
* - forum.processing.org/two/discussion/23924/handling-command-line-arguments-in-a-sketch
* - forum.processing.org/two/discussion/6457/how-to-use-arguments-with-an-application-built-with-processing
*/
// Some editing by GLV & Chrisir. See original (above) for the complete version.
color setBack = 0;
String str1;
void setup() {
size (770, 770);
// Local command-line arguments for testing:
// String [] args = {"external", "foo", "bar=baz", "lorem=ipsum dolor sit amet, consectetur adipiscing elit", "etc"};
if (args == null) {
println("args is null");
str1 = "no args / internal";
} else {
printArray(args);
str1 = args[0];
}//else
}//func
void draw() {
background(setBack);
text( str1, 20, 20 );
}
//
keywords: command line, cmd, cmdline, args, arguments, starting, start of Sketch, environment