Input Data from Command Line

This is a few years old but still works with W10

This is a version 0.1 of mouse buttons sending command-line arguments to an app (app not included here):

import java.io.*;
String str1 = "3000";
int num = 1000;
boolean inc = false;
int num2 = 100;
boolean inc2 = false;

void settings()
  {
  size(200, 150, P2D);
  }
  
void draw()
  { 
  background(0);
  fill(255, 255, 0);
  textAlign(CENTER, CENTER);
  textSize(36);
  text(num, 100, 50);
  text(num2, 100, 100); 
  }
  
void mousePressed()
  {

  if (mouseButton == LEFT)
    {
    if (inc)
     num+=100;
    else
     num-=100;    
    
    if (num > 6500)
      {
      inc = false;
      num = 6500;
      }
    
    if (num < 1000)
      { 
      inc = true;
      num = 1000;
      }
  }  

  if (mouseButton == RIGHT)
    {
    if (inc2)
     num2+=5;
    else
     num2-=5;    
    
    if (num2 > 100)
      {
      inc2 = false;
      num2 = 100;
      }
    
    if (num2 < 20)
      { 
      inc2 = true;
      num2 = 20;
      }
  }  

  launch("C:\\app\\app.exe", Integer.toString(num), Integer.toString(num2));
  println(num, " ", num, " ", num2);
  }
1 Like