1. Marina Grafit
  2. PowerBuilder
  3. Sunday, 1 August 2021 12:28 PM UTC

Hi,

 

How should I open a Chrome window from PB2019 with parameters...

I use:

Run ("chrome.exe "  + ls_url1 + String(ll_cust_No) + ls_url2)

But get -1 

 

Please Help

 

Regards,

Marina

Marina Grafit Accepted Answer Pending Moderation
  1. Monday, 2 August 2021 09:02 AM UTC
  2. PowerBuilder
  3. # 1

Hi,

 

When I provide the hole path it worked:

run ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe "  + ls_url1 + String(ll_cust_No) + ls_url2)

 

so, I used :

RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\"+as_browser+".exe","", RegString!, ls_exe)
		

it works fine now

 

Thank you for your help

Marina

Comment
  1. Miguel Leeuwe
  2. Monday, 2 August 2021 14:32 PM UTC
Glad it works, though Armeen makes a valid point: Are your sure all of your users will have Chrome installed?

Please mark as resolved.

regards.
  1. Helpful
  1. Marina Grafit
  2. Tuesday, 3 August 2021 05:29 AM UTC
Usually yes, but if for some reason no Chrome installed , I check what's in ls_exe param .



Thanks
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Sunday, 1 August 2021 16:02 PM UTC
  2. PowerBuilder
  3. # 2

How can you guarantee Chrome is installed?  I like Miguel’s suggestion to use HyperlinkToUrl() or you can consider to use the new Chromium WebBrowser control.  https://docs.appeon.com/pb2019r3/pbug/ch04s05.html

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 1 August 2021 14:09 PM UTC
  2. PowerBuilder
  3. # 3

Hi Marina,

I'd recommend the ShellExecute windows API:

Please see: https://community.appeon.com/index.php/qna/q-a/how-to-open-google-chrome-from-powerbuilder#reply-25239

regards

Comment
  1. Miguel Leeuwe
  2. Sunday, 1 August 2021 14:23 PM UTC
Make sure the the string for the url is enclosed in single quotes and that it starts with a double quote and ends with a double quote (followed by the closing single quote). If Chrome is your default browser, then see another way of doing it here, by using HyperLinkToUrl:

https://community.appeon.com/index.php/qna/q-a/replace-spaces-with-20-so-i-can-view-link-in-browser#reply-28569



string ls_url

inet linet_base

ls_url = '"file:///C:/temp2/folder with spaces/New Text Document.txt"'

GetContextService("Internet", linet_base)

linet_base.HyperlinkToURL(ls_url)

  1. Helpful
  1. Miguel Leeuwe
  2. Sunday, 1 August 2021 14:24 PM UTC
If you really want to use the Run() command to open Chrome.exe, you'll probably have to precede the executable name with the full path. Maybe you can see how Toby gets that path in the first link that I provided for the ShellExecute(), there's some useful code there.

regards.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.