Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
forcing QM to use browser other than IE
#1
Hi, Gintaras et al.!  My institution is using QM v2.4.2.2 under Windows (mostly Win10 at this time); and, because IE is going away, I need to change some code that is trying to open a URL w/ POST data (the institution just forced all IE-opening URLs to open Edge, and POSTing won't work when a blank IE window opens Edge...).  Here's the code that I've been unsuccessful at changing:
---
Request a Call Back :web2 "NWRadWeb/criticalresultscallback.php" _s.from("username=",ps_get_user,"&accession=",ps_get_acc(0)) 8 1000 1000

and web2 is
===function str'url str'args int'flags int'x int'y
int w
VARIANT postdata
VARIANT headers = "Content-Type: application/x-www-form-urlencoded[]"

if args.len>0
    ARRAY(byte) a.create(args.len)
    memcpy(&a[0] args a.len)
    postdata.attach(a)

SHDocVw.IWebBrowser2 b=web("" flags "" "" 0 w)
b.Navigate(url @ @ postdata headers)
siz x y w
===
---
What can I do in order to open the passed url with its postdata within the user's default browser?  Thanks!

The author of the code noted above is the user who many years ago asked the Q noted here: open web page with POST variables (quickmacros.com) .  I tried writing a web3 function to which I passed two POST arguments and values, but it's not opening a default-browser page w/ the POST data -- here's that function's current code after the calling line:
---
Request a Call Back :web3 "NWRadWeb/criticalresultscallback.php" "username" ps_get_user "accession" ps_get_acc(0) 8 1000 1000

===
function str'url str'args1a str'args1b str'args2a str'args2b int'flags int'x int'y
int w
VARIANT headers = "Content-Type: application/x-www-form-urlencoded[]"

Http Tomer.Connect("NWRadWeb")
SHDocVw.IWebBrowser2 b=web("" flags "" "" 0 w)
Tomer.PostAdd(args1a args1b)
Tomer.PostAdd(args2a args2b)
Tomer.PostFormData(url 0 0 headers)
siz x y w
===
---
#2
Other web browsers probably don't have API like IWebBrowser2.Navigate or command line to open a web page directly with a POST request.

Several other ways, not tested:

1. If don't need to show results in web browser, use browserless POST, for example function Http.PostFormData.

2. Else, try to automate Edge with accessible object functions or keyboard/mouse functions: fill and submit the form. Don't know how to do it if there is no form.

3. Try to automate Edge with Selenium: let it execute a javascript code that sends a POST request. For it it's better to use C# Uiscripter, it's a new program similar to Quick Macros. Maybe possible in Quick Macros too, but not so easy, and I did not test it many years.
#3
Thanks, Gintaras.
#4
I worked around the issue by 'run'ning the Webpage, specifying the param.s via GET rather than POST; and then to make my life easier inside the PHP script, I simply set the relevant $_POST array instance based on the received $_GET value Smile.  Thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)