We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Command Line Options Syntax
Page Index Toggle Pages: 1
Command Line Options Syntax (Read 1431 times)
Command Line Options Syntax
May 26th, 2005, 7:46pm
 
I am trying to locate where the command line
syntax options (such as -present and -display)
are documented. In particular, I see that
"-display 1" generates a full screen display.
What is the corresponding option for a windowed
display? Are there other options we should know
about? Thanks.
Re: Command Line Options Syntax
Reply #1 - Jun 1st, 2005, 1:16am
 
they'll be documented once they're more complete. right now they're documented somewhat in the code itself, but they're still going to change a couple times before i'm ready to call that the real api.
Re: Command Line Options Syntax
Reply #2 - Sep 15th, 2005, 4:15pm
 
so how could one start up an applet from the commandline without it becoming fullscreen?

I'd like it to have the size that I define in the code :
size(300, 700);

thanks
Re: Command Line Options Syntax
Reply #3 - Sep 15th, 2005, 6:08pm
 
can really help you, just know that "display 1" is specifying which display should be used for presenting (if you have multiple.

In this thread are some ideas about that.
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpenGL;action=display;num=1114730164
Re: Command Line Options Syntax
Reply #4 - Sep 18th, 2005, 1:41pm
 
Ok I figured this out. (really simple)

Just omit the arguments and then it launches in its correct size:

static public void main(String args[]) {
  PApplet.main(new String[] { "boxes02" });  // boxes02 is the name of the jar
}

But now my next question would be:
How can I pass arguments to the program when launching it from the command line?

In Java one could do:

   public static void main(String[] args){
       new Framework(args[0], args[1]);
   }

where the constructor would assign the arguments passed from the command line? How does one do that in Processing?
There is no constructor or what? Perhaps there is... I'll go and check now.

But any tips are welcome.
Re: Command Line Options Syntax
Reply #5 - Sep 18th, 2005, 3:04pm
 
any arguments after the "boxes02" will be passed to the applet as the variable "args". see the source code for PApplet.main() if you're curious to see how it works.

there's not constructor because PApplet is a subclass of Applet, and adding a constructor may prevent things from working properly.
Re: Command Line Options Syntax
Reply #6 - Sep 18th, 2005, 4:10pm
 
Thanks for that Fry, this clarifies things.

I had a look at the PApplet source file, but I don't get where to get the 2nd argument though (in the sketch).

The first argument (the name of the sketch "boxes02") is the first argument, no probs.

The second argument should be the number of the boxes:
static public void main(String args[]) {
    println("args length is " + args.length);
    PApplet.main(new String[] { args[0], args[1]});
 }

Where I run this in the command line:
java -jar boxes02.jar boxes02 122

But what I want is to have somewhere (in a constructor - no you don't recommend that) a line where I get the number of boxes from the command line into the sketch. such as:

int numBoxes = int(args[1]); // the second argument I pass from cmdline

Now I've tried to put it into the setup() method in my sketch:

void setup(){
 println("args 1 " + args[4]);
 ....

and I thought that args[4] would be the number passed (as the first arguments to PApplet seem to be --external --display=1, sketchLoc and sketchName.

Where can I get at the number passed after the sketchname in the commandline?
java -jar boxes02.jar boxes02 122

Thanks for all help

Re: Command Line Options Syntax
Reply #7 - Sep 18th, 2005, 4:43pm
 
that you just use the regular 'main'.

PApplet.main(new String[] { "boxes02.jar", "boxes02", "122" });

and PApplet's main() will subset the args passed in so that inside setup():

void setup() {
 String param1 = args[0];
 String param2 = args[1];
}

but you have to use PApplet.main() for that. and the -jar option should work on export as of rev 0092 or so, but not for things that use other libraries.
Page Index Toggle Pages: 1