Search code examples
launcherinstall4j

How can install4j condition check if launcher is UI or console application launcher?


I'd like to display different license text if I'm running on the console or with a UI (plain text vs html text). I think I can do this via conditions on my screens but I'm unsure of how to determine what kind of launcher is running.

I think I'd use LauncherSetup.getType() and can get LauncherSetup getLauncherById(java.lang.String id) if I can figure out the id of the running launch, but I'm not sure how to get the running Launcher's id.

Please let me know if you have a solution for this situation. If now, I'll post my code when I've figured out how to get the launcherID

Thanks

Peter


Solution

  • You can add the "Display license agreement" screen twice. On the first instance, use the HTML file and set the condition expression to !context.isConsole(), on the second instance, use the plain text file and set the condition expression to !context.isConsole().

    However, install4j can automatically convert the HTML text to plain text in console mode. This only works if your HTML file starts with <html>.