Jump to content

Recommended Posts

Posted (edited)

Thanks @Gianni 👌 for you pretty good summary of the topic, the findings and the links.
I didn't test it yet, but I will definitely.

💡 One little (but important) hint:
Please be aware of the license of the ActiveX OrdoWebView2 Control. It's not a big deal, because it's very open and friendly regarding reusability. But still, keep in mind the licenses of third-party tools (as always).

Best regards
Sven

Edited by SOLVE-SMART

==> AutoIt related: 🔗 GitHub, 🔗 Discord Server

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted (edited)
Posted (edited)

Sadly I get this error:

#cs
main.au3 (34) : ==> COM Error intercepted !
    err.number is:      0x00000001
    err.windescription: Failed to create object
    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  34
    err.retcode is:     0x00000000
#ce

; line 34 is:
Local $oOrdoWebView2 = ObjCreateInterface($pIUnkown, "{E54909AA-1705-44A9-8235-B24F74366B3F}")

I checked my registry for that "E54909AA-1705-44A9-8235-B24F74366B3F" IID (CLSID), but no such entry available 😔 .
I used .\OrdoWebView\OrdoRC6\RegisterRC6inPlace.vbs and .\OrdoWebView\OrdoRC6\RegisterRC6WidgetsInPlace.vbs (from the 7z archive of Danyfirex's post) to register the RC6*.dll's. I did not register .\OrdoWebView\OrdoWebView2.ocx and startet the OrdoWebView2_Demo.au3 (which is called main.au3 in my case).

👉 I use x64 Win10 (latest version, german system) and AutoIt v3.3.16.1.

Several errors appear in the console output, starting with the one above.
When I try to register the *.ocx file by regsvr32 C:\...\OrdoWebView\OrdoWebView2.ocx I get an access denied hint. I run the cmd.exe as admin, but still access denied.

I really do not want to install OrdoWebView2 SDK (OrdoWebView2ActiveXControl.2.0.9.exe), but maybe I have to?

Any suggestions are welcome - thanks.

Best regards
Sven

Edited by SOLVE-SMART

==> AutoIt related: 🔗 GitHub, 🔗 Discord Server

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted (edited)

Idk if this will make any difference, but when I registered the ocx I was inside the folder where it was located (instead of entering the full path).

ps. i did not install the SDK.  Just the .7z of Dany

pps. you need to run it x86, it does not work x64

Edited by Nine
Posted
13 minutes ago, Nine said:

Idk if this will make any difference, but when I registered the ocx I was inside the folder where it was located (instead of entering the full path).

It is a difference - it works 😆 .
Thank you @Nine. I don't get it why it works in that way, but now I can see the four WebView instances in the AutoIt GUI.

Now I can start with some experiments 🎉 .

Best regards
Sven

==> AutoIt related: 🔗 GitHub, 🔗 Discord Server

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted

Did you @Nine run the *.vbs scripts in the .\OrdoWebView\OrdoRC6 folder? Are they needed to be executed?
 

==> AutoIt related: 🔗 GitHub, 🔗 Discord Server

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted (edited)

Indeed, no need to register anything other than OrdoWebView2.ocx
You just need a folder containing the files as shown in the figure below

\MYFOLDER
    |   OrdoWebView2.ocx
    |   OrdoWebView2.au3
    |   OrdoWebView2_Demo.au3
    |
    \---OrdoRC6
            cairo_sqlite.dll
            DirectCOM.dll
            RC6.dll
            RC6Widgets.dll
            RegisterRC6inPlace.vbs
            RegisterRC6WidgetsInPlace.vbs
            WebView2Loader.dll
           _Library-Licenses.txt
           _Version-History.txt

(You can find the necessary files in the 7z file in @Danyfirex's post as indicated in first post above)

As @Ninedid, I also did the following:

  • created a folder containing necessary files as above
  • opened a DOS prompt with administrative rights;
  • placed the current directory where the OrdoWebView2.ocx file is located
  • I typed the following command:   regsvr32 .\OrdoWebView2.ocx
  • I received the popup message with the message "DllRegisterServer in .\OrdoWebView2.ocx succeeded"
  • That's it,

then running the OrdoWebView2_Demo.au3 file everything worked fine

thanks all for the feedbacks

Edited by Gianni

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

Okay fine, nice.

Now the Events are interesting (for me). Especially "JSAsyncResult", like you already wrote in the VB forum @Gianni.
It should be possibile to interact with html elements based on JS events/interactions/modifications, am I right?

This will be really nice, because I would not need a AutoIt WebServer anymore to have nice looking UIs with a AutoIt backend 😀 .

Best regards
Sven

==> AutoIt related: 🔗 GitHub, 🔗 Discord Server

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted (edited)

Everytime I would use OrdoWebView in a different project (folder) with different name, I have to regsvr32 .\OrdoWebView2.ocx from the cmd.exe (as admin) again. This is quite annoying. I guess I will make a init routine to do this automatically in case the path is not registered yet.

----------------------

I realized that not all files in OrdoRC6 are necessary (at least not right now for the demo).
My folder structure (template) looks like this at the moment.

Spoiler
autoit-webview
|   .gitignore
|   .prettierrc.json
|   LICENSE.md
|   package.json
|   README.md
|
+---build
|       .gitkeep
|
+---lib
|   |   draft-udf.au3 (previously OrdoWebView2_Demo.au3)
|   |
|   \---OrdoWebView2
|       |   license.md
|       |   OrdoWebView2.ocx
|       |
|       \---OrdoRC6
|               cairo_sqlite.dll
|               DirectCOM.dll
|               RC6.dll
|               third-party-licenses.md
|               WebView2Loader.dll
|
\---src
    |   main.au3
    |
    +---handler
    |       .gitkeep
    |
    +---maps
    |       .gitkeep
    |
    \---utils
            .gitkeep

 

Btw: Ignore the ".gitkeep" files.

----------------------

Anyhow, I am curious how far we as community can and will go with OrdoWebView2 😀 .

Best regards
Sven

Edited by SOLVE-SMART

==> AutoIt related: 🔗 GitHub, 🔗 Discord Server

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Posted

A first attempt at interaction between AutoIt and OrdoWebView2
it seems to me that some small anomalies occur (but maybe it's me who doesn't use them correctly), such as: the value of an AutoIt variable set by reading the value of a property of a browser object is not immediately available in AutoIt, but delays must be inserted before reading its value.
However, I have set 3 callback functions related to the following events: "navigation completed"; "zoom change" and "asynchronous JS result".
In particular, this last event should be executed only if you use the execution of a javascript script using the RunJsAsync() method. well, although I have not used that method in the AutoIt script but have only used the RunJs() method, I see that the JSAsyncResult callback function is occasionally executed anyway (?).
Well, this test script uses a web page that contains a "label" where the text changes to "I'm not a robot" only when the three red cubes have been clicked. (You could use this as a sort of graphical "CAPTCHA"). You can rotate the cube by dragging with the mouse so that any red cubes that are "on the back" come to the forefront so that you can click them.
The interaction with AutoIt consists of reading the value of that JS field to check when it changes to "I'm not a robot" and acting accordingly in AutoIt.
It seems to work, but I think I still need to dig deeper into this functionality.
The zoom change event is executed when the browser zoom is changed. To change the zoom you can hold down the "ctrl" key on the keyboard and simultaneously rotate the mouse wheel up or down. To reset the zoom to 100% press "ctrl" and zero on the numpad.
Here is the "experiment".

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include "OrdoWebView2.au3"

Global $bReloaded = False ; to be used in NavigationCompleted callback function

_TestOrdoWebView()

Func _TestOrdoWebView()

    Local $hMain_GUI = GUICreate("Main GUI", 500, 520, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    Local $hButton1 = GUICtrlCreateButton("I give up", 10, 495, 480, 20)

    GUISetState(@SW_SHOW, $hMain_GUI)

    Local $aEBWebView1 = webview2_GUI_Create(480, 480, 10, 10, $hMain_GUI, "_OrdoWebView_") ; 6° parameter: Events Callback funcion name prefix

    ; a javascript function to be injected in Document for a later use from AutoIt via .RunJs or .RunJsAsync
    $aEBWebView1[0].AddScriptToExecuteOnDocumentCreated("function getQSValue(qsExpr){return document.getElementById((qsExpr)).innerHTML}")
    ; Load web page
    $aEBWebView1[0].Navigate("https://shzlw.github.io/design/I-am-not-a-robot.html")

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $hButton1
                MsgBox(0, 'AutoIt', "Test failed. Goodbye")
                ExitLoop
        EndSwitch

        If $aEBWebView1[0].RunJs("getQSValue", "label") = "I'm not a robot" Then
            MsgBox(0, 'AutoIt', "Great! You are not a robot. Welcome human!")
            $aEBWebView1[0].Reload

            Do
                ConsoleWrite('.')
            Until $bReloaded
            $bReloaded = False
            ; if there is not this MsgBox to produce a long delay sometimes the reload is executed twice
            MsgBox(0, 'AutoIt', "Play again")
        EndIf

    WEnd
    _SysFreeString($pProgID)
    GUIDelete($aEBWebView1[1])
    GUIDelete($hMain_GUI)
EndFunc   ;==>_TestOrdoWebView

; --- CallBack functions ---
Volatile Func _OrdoWebView_NavigationCompleted($IsSuccess, $WebErrorStatus)
    ConsoleWrite("_OrdoWebView_NavigationCompleted" & @CRLF)
    $bReloaded = True
EndFunc   ;==>_OrdoWebView_NavigationCompleted

Volatile Func _OrdoWebView_ZoomChanged($iValue)
    ConsoleWrite("New Zoom Value is : " & $iValue & @CRLF)
    TrayTip("Zoom changed", "New zoom value is: " & $iValue, 3, 17)
EndFunc   ;==>_OrdoWebView_ZoomChanged

Volatile Func _OrdoWebView_JSAsyncResult($vResult, $vToken, $sErrString)
    ConsoleWrite("Javascript result: " & $vResult & @CRLF & $vToken & @CRLF & $sErrString & @CRLF)
EndFunc   ;==>_OrdoWebView_JSAsyncResult

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...