What is the best way to open a website from a unface desktop frm ...
My method is to create a batch file(1.bat) with the text start https:\\mysite.com, and then activate an OS service which runs the created batch file.
Im thinking there may be a better method.
The problem I am having is that the website url has % in it, and the os service seems to be removing the percents in the case of opening a web site(not in the case of a dos command)...
ex: https:\\mysite.com?myvar=%1%
So, my problem is how to open a website via a uniface desktop application that contains %'s
------------------------------
Osman Shariff
------------------------------
Hi
I don't know if it is the best method but I use OS signature to start the default browser (or specific one using the name of executable file: firefox.exe, chrome.exe, ...)
activate "OS".command("cmd.exe /c start %%(VC_URL)")
And, to avoid problems with data within the querystring, you have to use $encode function. Probably, you need to handle querystring as an associative list and replace its values by an urlencoded version.
putitem/id VA_querystring, "myvar", $encode("URL", "%1%") ; VA_querystring = myvar=%251%25
putitem/id VA_querystring, "other", $encode("URL", "%2%")
(Browser knows that %25 means "%")
Finally, replace list separators (·;) by &. VC_querystring = $replace(VA_querystring, 1, "·;", "&", -1), and concatenate both separated by ?
;result should be https://mysite.com?myvar=%251%25&other=%252%25
Regards
------------------------------
Luis Vila
luis.vila@uniface.es
Spain
------------------------------
Hi
I don't know if it is the best method but I use OS signature to start the default browser (or specific one using the name of executable file: firefox.exe, chrome.exe, ...)
activate "OS".command("cmd.exe /c start %%(VC_URL)")
And, to avoid problems with data within the querystring, you have to use $encode function. Probably, you need to handle querystring as an associative list and replace its values by an urlencoded version.
putitem/id VA_querystring, "myvar", $encode("URL", "%1%") ; VA_querystring = myvar=%251%25
putitem/id VA_querystring, "other", $encode("URL", "%2%")
(Browser knows that %25 means "%")
Finally, replace list separators (·;) by &. VC_querystring = $replace(VA_querystring, 1, "·;", "&", -1), and concatenate both separated by ?
;result should be https://mysite.com?myvar=%251%25&other=%252%25
Regards
------------------------------
Luis Vila
luis.vila@uniface.es
Spain
------------------------------
Thanks Luis, that was very insightful... and I got it working.
In my case I already new the encoding so I did not need that bit, but it was very interesting.
What worked for me was by calling the url direct in the activate as you did.
I am not sure why, but writing to a .bat and then running the .bat in the activate lost the % characters.
------------------------------
Osman Shariff
------------------------------
Thanks Luis, that was very insightful... and I got it working.
In my case I already new the encoding so I did not need that bit, but it was very interesting.
What worked for me was by calling the url direct in the activate as you did.
I am not sure why, but writing to a .bat and then running the .bat in the activate lost the % characters.
------------------------------
Osman Shariff
------------------------------
Hi,
just spawn an explorer with the document you want.
Works with html and office-Documents as well.
spawn "explorer.exe %%"%%(V_URL)%%""
------------------------------
Norbert Lauterbach
Infraserv Gmbh & Co. Höchst Kg
Frankfurt DE
------------------------------