Using launch() to start chrome.exe

I’m trying to launch chrome.exe via launch();
It works fine if I just want to start chrome.exe. My issue is that I can’t figure out how to pass an url to chrome.exe.

If I start chrome via command shell with an url it works just fine, but nothing happens if I du the same using launch(“C:/Program Files/Google/Chrome/Application/chrome.exe https://www.nationalgeographic.com”).

Does anyone know what I do wrong?

Thanks :slight_smile:
Jorgensen

Hi @jorgensen,

You need to separate the program from arguments…
Try:

launch(“C:/Program Files/Google/Chrome/Application/chrome.exe","https://www.nationalgeographic.com");

Cheers
— mnse

3 Likes

Hello @jorgensen ,

This works on W10 with Processing 4.3:

/* 
 * Launch Example 1
 * v1.1.1
 * GLV 2024-07-14
*/

void setup() 
  { 
  //Works:
  String s = "\"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe\" www.howtogeek.com";
  println(s);
  launch(s);
  }

I had to modify reference below for new location and spaces.

Reference:

There may be other ways to do this.

String / Reference / Processing.org will explain this:

:)

1 Like

Thanks to both glv and mnse for a very quick and helpfull reply!

So simple, I just did’nt know that parameters needed to be added that way :slight_smile:

Thanks
Jorgensen

1 Like

I’ve got it to work the way I wanted - and exported via File > export application - so cool.

I just wonder if there is a way to shorten the startup time for the app?
When I press the shortcut, it takes 4-5 seconds before the app starts.

Can I install open java as part of windows so the app does not need to load java before starting? Could that shorten the startup time? Or is there other tricks - or is that just the way it is?

Thanks
Jorgensen