Forward parameters from the command line to a project
It is possible to forward parameters from the command line to GroIMP using additional parameters beginning with an capital X.This parameters need to be added before other specifications such as –headless or the path to a model.
This parameter can than be accessed by all models opened.
For a model that is suppose to greed the user this additional parameter could be the name, therefore the command line parameter would be -Xname=“gaetan”
.
To access this parameter than in GroIMP the function getProperty of the class Main needs to be called:
import de.grogra.pf.boot.Main; public void sayHi(){ println("hallo "+Main.getProperty("name")); }
This works with multiple parameters and is especially useful in the headless mode:
import de.grogra.pf.boot.Main; protected void startup() { super.startup(); if (Main.getProperty("headless") != null) { runLater(null); } } protected void run(Object info) { println("hallo " + Main.getProperty("name")); }
This provides the possibility to forward knowledge/information or the path to specific configuration to a GroIMP model without changing the model.