Page 1 of 1

[Solved] How to use RunProgram() with mixed quote argument?

Posted: Mon Jun 16, 2025 11:35 am
by jacky
Hi,

Edit: Solved, I was just a bit blind (apart from the necessary tip by Nic that the url part should be encoded) :)

I want to call my .exe with two arguments:
01. The full path to an executable (a browser)
02. GPS coordinates like: 56°33'29,0N 38°8'49,3E

These coordinates depend on the used locale so the comma will be replaced with a dot (otherwise google won't find them on a map).

Code: Select all

  Define.s arg1, arg2, url

  arg1 = ProgramParameter(0)
  arg2 = ReplaceString(ProgramParameter(1), ",", ".")
  url  = "https://www.google.com/maps/place/" + arg2

  RunProgram(arg1, url, GetTemporaryDirectory())
Calling the compiled .exe with:

Code: Select all

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" 56°33'29,0"N 38°8'49,3"E
fills the three variables with the correct content but actually running msedge with the url as the argument leads to two tabs with nonsense in them.
Note: Yes, in general I find it strange that the coordinates are accepted as just a single argument as well ;)

Obviously it doesn't like the mix of a space, single and double quotation marks?

So, how to accomplish it that RunProgram calls the browser with:

Code: Select all

https://www.google.com/maps/place/56°33'29.0"N 38°8'49.3"E
Any clues?

Re: How to use RunProgram() with mixed quote argument?

Posted: Mon Jun 16, 2025 12:16 pm
by NicTheQuick
You might try `URLEncoder()` to actually encode the special characters in the URL properly.

Re: How to use RunProgram() with mixed quote argument?

Posted: Mon Jun 16, 2025 12:25 pm
by jacky
Thanks Nic.

The encoded url looks like this:

Code: Select all

https://www.google.com/maps/place/56%C2%B033'29.0N%2038%C2%B08'49.3E
When RunProgram() is called it will still fail to supply it to the browser correctly, I still get two tabs:
Address bar part of the first one:

Code: Select all

xn--5633'29-bla.0n
Of the second one:

Code: Select all

xn--388'49-xja.3e
When I paste the encoded url into the address bar manually and hit enter, google maps will display the correct location though.

Something's off with RunProgram() here...

Only change in the code was:

Code: Select all

url  = "https://www.google.com/maps/place/" + URLEncoder(arg2)

Re: How to use RunProgram() with mixed quote argument?

Posted: Mon Jun 16, 2025 12:27 pm
by Caronte3D
Try to wrap every arg with: #DQUOTE$ (not tested).

Re: How to use RunProgram() with mixed quote argument?

Posted: Mon Jun 16, 2025 12:31 pm
by jacky
@Caronte3D Thanks, but this isn't necessary.

@Nic
Thanks again, the url encoding was all that was needed, I was blind, I called it with arg2 and not url as the argument for RunProgram()^^

Problem solved, it now works as expected :oops: