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

Just starting out? Need help? Post your questions and find answers here.
jacky
User
User
Posts: 66
Joined: Mon Jan 21, 2019 1:41 pm

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

Post 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?
Last edited by jacky on Mon Jun 16, 2025 12:33 pm, edited 4 times in total.
User avatar
NicTheQuick
Addict
Addict
Posts: 1517
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

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

Post by NicTheQuick »

You might try `URLEncoder()` to actually encode the special characters in the URL properly.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
jacky
User
User
Posts: 66
Joined: Mon Jan 21, 2019 1:41 pm

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

Post 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)
User avatar
Caronte3D
Addict
Addict
Posts: 1361
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

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

Post by Caronte3D »

Try to wrap every arg with: #DQUOTE$ (not tested).
jacky
User
User
Posts: 66
Joined: Mon Jan 21, 2019 1:41 pm

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

Post 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:
Post Reply