Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Javascript Vars
#6
This was handled by email.

For the rest reading along, it was a script error in the anonymous function.

So how does one figure that out?

The WebView2 control that the AntView control hosts is a full browser, it does come with a debugger.
As long as the developer tools haven't been disabled, you can use those debugging features for your benefit.
Right click on the rendered html and click "inspect" from the context menu. (Another way to invoke the debugger is to press F12 after clicking on the AntView control)

The next thing you should know is that the anonymous function is executed in the browser as a function "AntAnonymousFunction".
With those 2 tricks on your sleeve, you can now put a breakpoint.

First make sure the anonymous function was run at least once already (in our case we clicked the button that invoked the RunAnonymousFunction method that we want to debug)

Now type AntAnonymousFunction in the debug console, like so

   

double click on the function content and it opens a new tab.
   

This then is the debugger tab and you can put a breakpoint. I did put one on the "app" line and noticed that when I stepped over the function - after triggering it from VB6 - that it went into the void on the line "PlayerTime = "

After seeing that I triggered it again and now instead of stepping over the line I went to the console tab and tried it there.
   

This means that app.currentTime is not a function, but a variable!

By changing our script in the VB6 anonymous function to take that into account,

   

we now have it working without having to resort to async await or timers or anything else...

   

Hoping that this fixes it on your end as well.

--
Wil
Reply


Messages In This Thread
Getting Javascript Vars - by maddire - 2022-04-20, 09:50:40
RE: Getting Javascript Vars - by wila - 2022-04-20, 10:37:47
RE: Getting Javascript Vars - by maddire - 2022-04-20, 10:59:58
RE: Getting Javascript Vars - by wila - 2022-04-20, 11:33:07
RE: Getting Javascript Vars - by maddire - 2022-04-20, 13:43:25
RE: Getting Javascript Vars - by wila - 2022-04-20, 17:12:35
RE: Getting Javascript Vars - by maddire - 2022-04-20, 18:30:49
RE: Getting Javascript Vars - by maddire - 2022-04-22, 18:20:58
RE: Getting Javascript Vars - by wila - 2022-04-25, 08:40:43

Forum Jump:


Users browsing this thread: 1 Guest(s)