Jump to content

Microsoft Edge - WebView2, embed web code in your native application


mLipok
 Share

Recommended Posts

Thanks for the answers,
... if I compile the script all is fine, but if i don't compile and i just run it from SciTE (F5) i get the error as in obove posts, and this is what i would like to avoid if possible (would be interesting to understand why for someone it works from SciTE and for others (or at least for me) it doesn't... 😕

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
Share on other sites

3 hours ago, Chimp said:

But where should I put these libraries to be able to run the script from SciTE without having to compile it every time I make a change?

You can try to copy WebView2Loader-x86.dll and WebView2Loader-x64.dll to the AutoIt installation folder. When you run a program in SciTE with F5 then either AutoIt3.exe or AutoIt3_x64.exe is the running executable.

I completely agree with you that it's inappropriate especially during program development that one cannot run the code directly from SciTE.

The reason why you cannot run the code from SciTE must probably be found on your own PC. argumentum, mLipok and I can actually run the code from SciTE on our PCs.

Link to comment
Share on other sites

Thank you @LarsJ for your suggestion
I copied the dlls into the autoit path, but again without success, however I think I have found the reason for the problem:
1) after copying the 2 dll to the autoit path, the error kept occurring
2) I tried to set #RequireAdmin on the script and, at this point, the following new error window appeared:


"Microsoft Edge cannot read and write to the data directory:
C:\ Program Files (x86) \ AutoIt3 \ autoit3_x64.exe.WebView2 \ EBWebView"


so the problem is that the AutoIt3 directory doesn't have write permission for local users.
That's all. it is not necessary to copy the DLLs to a location other than the script path.

my solution has been to set write/modify permissions to the AutoIt3 folder so to allow the script to create its own subfolder (on first run).
Once the subfolder was created, I restored the previous permission to the AutoIt3 folder and allowed the write/modify permission only to the newly created autoit3_x64.exe.WebView2 folder
This way everything works fine (... so far ...)

Thanks again for your tips

P.S.

@LarsJ  This WebView2 script you wrote is elite. I tried to study it and I see that you have for example also used portions of code (Func ObjectFromTag) that I had already seen (with awe) created by the queen of developers @trancexx in this other post.
But, now as then I must give up trying to understand. This type of code intimidates me, too complex for my poor understanding of the inner workings of Windows.
However I like to see powerful code like this appear on the forum thanks to programmers, like you and many others, who master these intricacies with great ease.

Thanks again :)

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
Share on other sites

Chimp, That's super debugging. We had the exact same problem a few years ago as discussed in this and the next many following posts related to .NET assembly dll-files. Your solution will in all likelihood also be the solution to this problem.

Link to comment
Share on other sites

@Chimp

As a note I use portable Au3 developer environment.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Hi LarsJ,

Based on @mLipok example.

You can add this to the examples :

HotKeySet("^+I", "DevTools") ; CTRL+SHIFT+I

;....

Func DevTools()
    $oCoreWebView2.OpenDevToolsWindow()
EndFunc

To make it compliant with the Edge standard.

Still missing an address bar and buttons to make it complete 😉

 

Edited by ptrex
Link to comment
Share on other sites

1 hour ago, ptrex said:

Still missing an address bar and buttons to make it complete

It should be done by your self.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

just doing some "random" (a bit messy) tests to get familiar, modifying the scripts of the examples; I placed a mini WebView on the GUI and tried to stress the "NavigateToString" method by passing an old html source for fun. I also placed a button on the GUI to try to use "ExecuteScript", but obviously it shouldn't be used this way, in fact the script fails. Anyone have an example of how to use "ExecuteScript"? More than trying to mimic a browser, I'm interested in being able to interact with the page content in the WebView. Thanks in advance to anyone who wants to help :)

#AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

#AutoIt3Wrapper_UseX64=y

Opt("MustDeclareVars", 1)

#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPICom.au3>
#include <WinAPI.au3>

Global $hGui

; Project includes
#include "..\Includes\WV2Interfaces.au3"

WebView2()

Func WebView2()
    ; Create WebView2 GUI
    $hGui = GUICreate("WebView2 Sample", 350, 100, -1, -1, $WS_OVERLAPPEDWINDOW)

    Local $Button1 = GUICtrlCreateButton("ExecuteScript", 5, 60, 170, 35)

    ; Initialize COM
    _WinAPI_CoInitialize($COINIT_APARTMENTTHREADED)

    ; Create callback interface and functions
    CoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerCreate(True)
    ; Forces CoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_Invoke() below to be executed

    ; Create callback interface and functions
    CoreWebView2CreateCoreWebView2ControllerCompletedHandlerCreate(True)

    ; Create callback interface and functions
    CoreWebView2NavigationStartingEventHandlerCreate(True)

    ; DllCall CreateCoreWebView2EnvironmentWithOptions
    Local $hWebView2Loader = DllOpen(@AutoItX64 ? "WebView2Loader-x64.dll" : "WebView2Loader-x86.dll")
    Local $aRet = DllCall($hWebView2Loader, "long", "CreateCoreWebView2EnvironmentWithOptions", "wstr", "", "wstr", "", _
            "ptr", Null, "ptr", $pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler)
    If @error Or $aRet[0] Then Return ConsoleWrite("CreateCoreWebView2EnvironmentWithOptions ERR" & @CRLF)
    ConsoleWrite("CreateCoreWebView2EnvironmentWithOptions OK" & @CRLF & @CRLF)

    ; Show WebView2 GUI
    GUISetState(@SW_SHOW)

    ; Loop
    While 1
        Switch GUIGetMsg()
            #cs
            Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED, $GUI_EVENT_RESTORE
                Local $tRect = _WinAPI_GetClientRect($hGui)
                $oCoreWebView2Controller.put_Bounds($tRect)
            #ce
            Case $Button1
                $oCoreWebView2.ExecuteScript("alert('Hello');")

            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    ; Cleanup
    CoreWebView2CreateCoreWebView2ControllerCompletedHandlerDelete()
    CoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerDelete()
    DllClose($hWebView2Loader)
EndFunc   ;==>WebView2

; Copied from WV2Interfaces.au3
; Executed automatically when the callback interface is created
Func CoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_Invoke($pSelf, $long, $ptr)   ; Ret: long  Par: long;ptr*
    ConsoleWrite("CoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_Invoke" & @CRLF)

    ; Create CoreWebView2Environment object
    $oCoreWebView2Environment = ObjCreateInterface($ptr, $sIID_ICoreWebView2Environment, $dtag_ICoreWebView2Environment)
    ConsoleWrite("IsObj( $oCoreWebView2Environment ) = " & IsObj($oCoreWebView2Environment) & @CRLF & @CRLF)

    ; Set $pCoreWebView2CreateCoreWebView2ControllerCompletedHandler callback pointer for the WebView2 GUI
    $oCoreWebView2Environment.CreateCoreWebView2Controller($hGui, $pCoreWebView2CreateCoreWebView2ControllerCompletedHandler)
    ; Forces CoreWebView2CreateCoreWebView2ControllerCompletedHandler_Invoke() below to be executed

    Return 0 ; S_OK = 0x00000000
    #forceref $pSelf, $long
EndFunc   ;==>CoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_Invoke

; Copied from WV2Interfaces.au3
; Executed as a consequence of $oCoreWebView2Environment.CreateCoreWebView2Controller() above
Func CoreWebView2CreateCoreWebView2ControllerCompletedHandler_Invoke($pSelf, $long, $ptr)   ; Ret: long  Par: long;ptr*
    ConsoleWrite("CoreWebView2CreateCoreWebView2ControllerCompletedHandler_Invoke" & @CRLF)

    ; Create CoreWebView2Controller object
    $oCoreWebView2Controller = ObjCreateInterface($ptr, $sIID_ICoreWebView2Controller, $dtag_ICoreWebView2Controller)
    ConsoleWrite("IsObj( $oCoreWebView2Controller ) = " & IsObj($oCoreWebView2Controller) & @CRLF)
    $oCoreWebView2Controller.AddRef() ; Prevent the object from being deleted when the function ends

    ; Set bounds for the CoreWebView2 object
    ; Local $tRect = _WinAPI_GetClientRect($hGui)
    ; $oCoreWebView2Controller.put_Bounds($tRect)
    Local $tagMyRECT = DllStructCreate($tagRECT)
    DllStructSetData($tagMyRECT, "Left", 5) ; left
    DllStructSetData($tagMyRECT, "Top", 5) ; top
    DllStructSetData($tagMyRECT, "Right", 345) ; right
    DllStructSetData($tagMyRECT, "Bottom", 50) ; bottom
    $oCoreWebView2Controller.put_Bounds($tagMyRECT)


    ; Create CoreWebView2 object
    $oCoreWebView2Controller.get_CoreWebView2($pCoreWebView2)
    $oCoreWebView2 = ObjCreateInterface($pCoreWebView2, $sIID_ICoreWebView2, $dtag_ICoreWebView2)
    ConsoleWrite("IsObj( $oCoreWebView2 ) = " & IsObj($oCoreWebView2) & @CRLF & @CRLF)

    ; Add NavigationStarting event handler
    Local $tEventRegistrationToken = DllStructCreate("uint64")
    $oCoreWebView2.add_NavigationStarting($pCoreWebView2NavigationStartingEventHandler, $tEventRegistrationToken)
    ConsoleWrite("DllStructGetData( $tEventRegistrationToken, 1 ) = " & DllStructGetData($tEventRegistrationToken, 1) & @CRLF & @CRLF)
    ; Forces CoreWebView2NavigationStartingEventHandler_Invoke() below to be executed

    ; Navigate to web page
     $oCoreWebView2.Navigate("about:blank") ; file:///" & @ScriptDir & "/index.html")

    Return 0 ; S_OK = 0x00000000
    #forceref $pSelf, $long
EndFunc   ;==>CoreWebView2CreateCoreWebView2ControllerCompletedHandler_Invoke

; Copied from WV2Interfaces.au3
; Executed as a consequence of $oCoreWebView2.add_NavigationStarting() above
Func CoreWebView2NavigationStartingEventHandler_Invoke($pSelf, $ptr1, $ptr2)   ; Ret: long  Par: ptr*;ptr*
    ConsoleWrite("CoreWebView2NavigationStartingEventHandler_Invoke()" & @CRLF)

    ; Create CoreWebView2NavigationStartingEventArgs object
    $oCoreWebView2NavigationStartingEventArgs = ObjCreateInterface($ptr2, $sIID_ICoreWebView2NavigationStartingEventArgs, $dtag_ICoreWebView2NavigationStartingEventArgs)
    ConsoleWrite("IsObj( $oCoreWebView2NavigationStartingEventArgs ) = " & IsObj($oCoreWebView2NavigationStartingEventArgs) & @CRLF & @CRLF)
    $oCoreWebView2NavigationStartingEventArgs.AddRef() ; Prevent the object from being deleted when the function ends

    ; Get navigation information
    Local $bIsUserInitiated, $bIsRedirected
    $oCoreWebView2NavigationStartingEventArgs.get_IsUserInitiated($bIsUserInitiated)
    $oCoreWebView2NavigationStartingEventArgs.get_IsRedirected($bIsRedirected)

    ; Confirm navigation
    If $bIsUserInitiated And Not $bIsRedirected Then
        #cs
        Local $sUri
        $oCoreWebView2NavigationStartingEventArgs.get_Uri($sUri)
        If MsgBox($MB_YESNO + $MB_ICONWARNING, "Navigation warning", "You are about to navigate to: " & $sUri & @CRLF & @CRLF & "Do you want to continue?") = $IDNO Then
            $oCoreWebView2NavigationStartingEventArgs.put_Cancel(True)
            $oCoreWebView2.NavigateToString("<h1>Navigation Canceled</h1><p>You chose to cancel navigation to the following URL: " & $sUri & "</p>" )
        EndIf
        #ce
        $oCoreWebView2.NavigateToString(_GetPage())
    EndIf

    Return 0 ; S_OK = 0x00000000
    #forceref $pSelf, $ptr1, $ptr2
EndFunc   ;==>CoreWebView2NavigationStartingEventHandler_Invoke
Func _GetPage()
    Local $sPageSource = ""
    $sPageSource &= "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & @CRLF
    $sPageSource &= "<HTML><HEAD><TITLE>L E D Panel Script</TITLE>" & @CRLF
    $sPageSource &= "<META http-equiv=Content-Type content=""text/html; charset=windows-1252"">" & @CRLF
    $sPageSource &= "<STYLE type=text/css>" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "body{" & @CRLF
    $sPageSource &= "background-color:black;" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "</STYLE>" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "</HEAD>" & @CRLF
    $sPageSource &= "<BODY onload=""LEDinit()"">" & @CRLF
    $sPageSource &= "<img src=""https://www.autoitscript.com/forum/cdn/images/logo_autoit_210x72.svg"" width=""100"" height=""35"" style=""position: absolute; top: 5px; left: 200px;"">" & @CRLF
    $sPageSource &= "<SCRIPT language=JavaScript>" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "//""L.E.D. Panel"" Script by Richard Maloney © 2002" & @CRLF
    $sPageSource &= "//For Custom effects, email Richard (ottawo@rogers.com)" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "//____________________CONFIGURATION AREA_____________________" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "// THIS LED SCRIPT TAKES UP 200 pixels HORIZONTAL and 28 pixels VERTICAL -Have Fun :-)" & @CRLF
    $sPageSource &= "// YOUR MESSAGE GOES ON NEXT 4 LINES DOWN." & @CRLF
    $sPageSource &= "// ALLOWABLE CHARACTERS ARE: A-Z, Period, space, comma, numerals, question mark and 'message codes'." & @CRLF
    $sPageSource &= "// THE 4 MESSAGE CODES:" & @CRLF
    $sPageSource &= "// @=PAUSE FOR 3 SECONDS,  #=FLASH FOR 3 SECONDS, ^=SCROLL UP EFFECT, _=SUN EFFECT, $=SPLIT EFFECT" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "//EXAMPLE: var message=""_  Dynamic^^   Drive!  #  For  the best dhtml scripts...    www.dynamic.drive.com    "";" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "var message=""HI EVERYONE@ LARSJ HAS DONE A VERY GOOD JOB#       WEBVIEW2^^ A POWERFUL TOOL !!!@$@    A NEW SUN HAS RISEN@_     "";" & @CRLF
    $sPageSource &= "var LEDonColor='Red';        //color of the LEDs when they are on" & @CRLF
    $sPageSource &= "var LEDoffColor='#7D0605';   //color of the LEDs when they are off" & @CRLF
    $sPageSource &= "startXPos=10;               //start of horizontal position eg. startXPos=20; places the leds 20 pixels from left" & @CRLF
    $sPageSource &= "startYPos=10;              //start of vertical position" & @CRLF
    $sPageSource &= "//____________________END CONFIGURATION AREA__________________" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "var IE=(document.all) ? true:false; var NS=(document.layers) ? true:false; var W3C=((document.getElementById) && (!IE)) ? true:false;" & @CRLF
    $sPageSource &= "var d=document; if (window.offscreenBuffering) window.offscreenBuffering = true;" & @CRLF
    $sPageSource &= "function getCSS(id) {" & @CRLF
    $sPageSource &= "   if (IE)      return d.all[id]           //IE" & @CRLF
    $sPageSource &= "   else if (NS) return d.layers[id]        //NS4" & @CRLF
    $sPageSource &= "   else         return d.getElementById(id)//W3C" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "var alphabet=new Array(44);" & @CRLF
    $sPageSource &= "alphabet[0]=new Array(""0111111"",""1001000"",""1001000"",""1001000"",""0111111"");    alphabet[1]=new Array(""1111111"",""1001001"",""1001001"",""1001001"",""0110110"");//B" & @CRLF
    $sPageSource &= "alphabet[2]=new Array(""0111110"",""1000001"",""1000001"",""1000001"",""0100010"");    alphabet[3]=new Array(""1111111"",""1000001"",""1000001"",""1000001"",""0111110"");//D" & @CRLF
    $sPageSource &= "alphabet[4]=new Array(""1111111"",""1001001"",""1001001"",""1001001"");                alphabet[5]=new Array(""1111111"",""1001000"",""1001000"",""1001000"");//F" & @CRLF
    $sPageSource &= "alphabet[6]=new Array(""0111110"",""1000001"",""1000001"",""1001001"",""0101110"");    alphabet[7]=new Array(""1111111"",""0001000"",""0001000"",""0001000"",""1111111"");//H" & @CRLF
    $sPageSource &= "alphabet[8]=new Array(""1000001"",""1111111"",""1000001"");                        alphabet[9]=new Array(""0000110"",""0000001"",""0000001"",""0000001"",""1111110"");//J" & @CRLF
    $sPageSource &= "alphabet[10]=new Array(""1111111"",""0001000"",""0010100"",""0100010"",""1000001"");   alphabet[11]=new Array(""1111111"",""0000001"",""0000001"",""0000001"");//L" & @CRLF
    $sPageSource &= "alphabet[12]=new Array(""1111111"",""0010000"",""0001000"",""0010000"",""1111111"");   alphabet[13]=new Array(""1111111"",""0010000"",""0001000"",""0000100"",""1111111"");//N" & @CRLF
    $sPageSource &= "alphabet[14]=new Array(""0111110"",""1000001"",""1000001"",""1000001"",""0111110"");   alphabet[15]=new Array(""1111111"",""1001000"",""1001000"",""1001000"",""0110000"");//P" & @CRLF
    $sPageSource &= "alphabet[16]=new Array(""0111110"",""1000001"",""1000001"",""1000011"",""0111111"");   alphabet[17]=new Array(""1111111"",""1001000"",""1001100"",""1001010"",""0110001"");//R" & @CRLF
    $sPageSource &= "alphabet[18]=new Array(""0110010"",""1001001"",""1001001"",""1001001"",""0100110"");   alphabet[19]=new Array(""1000000"",""1000000"",""1111111"",""1000000"",""1000000"");//T" & @CRLF
    $sPageSource &= "alphabet[20]=new Array(""1111110"",""0000001"",""0000001"",""0000001"",""1111110"");   alphabet[21]=new Array(""1110000"",""0001100"",""0000011"",""0001100"",""1110000"");//V" & @CRLF
    $sPageSource &= "alphabet[22]=new Array(""1111110"",""0000001"",""0000010"",""0001100"",""0000010"",""0000001"",""1111110""); alphabet[23]=new Array(""1100011"",""0010100"",""0001000"",""0010100"",""1100011"");//X" & @CRLF
    $sPageSource &= "alphabet[24]=new Array(""1100000"",""0010000"",""0001111"",""0010000"",""1100000"");   alphabet[25]=new Array(""1000011"",""1000101"",""1001001"",""1010001"",""1100001"");//Z" & @CRLF
    $sPageSource &= "alphabet[26]=new Array(""0000000"",""0000000"",""0000000"",""0000000"");           alphabet[27]=new Array(""0000000"",""0000001"",""0000000"",""0000000"",""0000000"");//PERIOD" & @CRLF
    $sPageSource &= "alphabet[28]=new Array(""0000000"",""0000000"",""1111101"",""0000000"",""0000000"");//!" & @CRLF
    $sPageSource &= "alphabet[29]=new Array(""0100001"",""1111111"",""0000001"");                       alphabet[30]=new Array(""0100011"",""1000101"",""1001001"",""1001001"",""0110001"");//2" & @CRLF
    $sPageSource &= "alphabet[31]=new Array(""0100010"",""1001001"",""1001001"",""1001001"",""0110110"");   alphabet[32]=new Array(""0001000"",""0011000"",""0101000"",""1111111"",""0001000"");//4" & @CRLF
    $sPageSource &= "alphabet[33]=new Array(""1111001"",""1001001"",""1001001"",""1001001"",""1000110"");   alphabet[34]=new Array(""0111110"",""1001001"",""1001001"",""1001001"",""0100110"");//6" & @CRLF
    $sPageSource &= "alphabet[35]=new Array(""1000011"",""1000100"",""1001000"",""1110000"");           alphabet[36]=new Array(""0110110"",""1001001"",""1001001"",""1001001"",""0110110"");//8" & @CRLF
    $sPageSource &= "alphabet[37]=new Array(""0110010"",""1001001"",""1001001"",""1001001"",""0111110"");   alphabet[38]=new Array(""0000001"",""0000010"",""0000000"");//COMMA" & @CRLF
    $sPageSource &= "alphabet[39]=new Array(""XXXXXXX"");//PAUSE ( @ )" & @CRLF
    $sPageSource &= "alphabet[40]=new Array(""YYYYYYY"");//FLASH ( # )" & @CRLF
    $sPageSource &= "alphabet[41]=new Array(""DDDDDDD"");//SCROLL UP EFFECT ( ^ )" & @CRLF
    $sPageSource &= "alphabet[42]=new Array(""SSSSSSS"");//SUN EFFECT ( _ )" & @CRLF
    $sPageSource &= "alphabet[43]=new Array(""0100000"",""1000000"",""1001101"",""1001000"",""0110000"");//?" & @CRLF
    $sPageSource &= "alphabet[44]=new Array(""QQQQQQQ"");//SPLIT EFFECT ( $ )" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "message=message.toUpperCase();                 //make message uppercase" & @CRLF
    $sPageSource &= "var messageArray=new Array();                  //make messageArray-an array of the letters in the message" & @CRLF
    $sPageSource &= "var columnCount=0;                                 //variable to count columns in messageArray.length" & @CRLF
    $sPageSource &= "for (i=0; i<message.length; i++){              //iterate through the characters in the message" & @CRLF
    $sPageSource &= "   letterNum=message.charCodeAt(i);            //assign proper letter code (alphabet array)" & @CRLF
    $sPageSource &= "   if ((letterNum>=65) && (letterNum<=90)) temp=letterNum-65; //letters" & @CRLF
    $sPageSource &= "   else if (letterNum==46) temp=27;            //." & @CRLF
    $sPageSource &= "   else if (letterNum==32) temp=26;            //space" & @CRLF
    $sPageSource &= "   else if (letterNum==33) temp=28;            //!" & @CRLF
    $sPageSource &= "   else if ((letterNum>=49) && (letterNum<=57)) temp=letterNum-20; //[1-9]" & @CRLF
    $sPageSource &= "   else if (letterNum==48) temp=14;            //zero" & @CRLF
    $sPageSource &= "   else if (letterNum==63) temp=43;            //?" & @CRLF
    $sPageSource &= "   else if (letterNum==44) temp=38;            //," & @CRLF
    $sPageSource &= "   else if (letterNum==64) temp=39;            //pause" & @CRLF
    $sPageSource &= "   else if (letterNum==35) temp=40;            //flash effect" & @CRLF
    $sPageSource &= "   else if (letterNum==94) temp=41;            //scroll up effect" & @CRLF
    $sPageSource &= "   else if (letterNum==95) temp=42;            //sunrise effect" & @CRLF
    $sPageSource &= "   else if (letterNum==36) temp=44;            //split effect" & @CRLF
    $sPageSource &= "   else continue;" & @CRLF
    $sPageSource &= "   for (ii=0; ii<alphabet[temp].length;ii++){ messageArray[columnCount]=alphabet[temp][ii];columnCount++;}" & @CRLF
    $sPageSource &= "   if ((temp!=39) && (temp!=40) && (temp!=41)) {messageArray[columnCount]=""0000000"";columnCount++;}" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "//make 'led screen' with block 0-49 on row 1, block 50-99 on row 2, block 100-149 on row 3, etc.." & @CRLF
    $sPageSource &= "var b='';" & @CRLF
    $sPageSource &= "for (var i=0; i<350; i++){//columns 50 columns x 7 rows" & @CRLF
    $sPageSource &= "   rowPos=0+3*(i>49)+3*(i>99)+3*(i>149)+3*(i>199)+3*(i>249)+3*(i>299);" & @CRLF
    $sPageSource &= "   colPos=0+150*(i>49)+150*(i>99)+150*(i>149)+150*(i>199)+150*(i>249)+150*(i>299);" & @CRLF
    $sPageSource &= "   b+= (NS) ? '<LAYER NAME=""block' + i + '"" LEFT=""' + (startXPos+i*3-colPos) + '"" TOP=""' + (startYPos+rowPos) + '"" VISIBILITY=""show"" WIDTH=""2"" HEIGHT=""2"" BGCOLOR=""' + LEDoffColor + '""></LAYER>' : '<div id=""block' + i + '"" style=""position:absolute; left:' + (startXPos+i*3-colPos) + 'px; top:' + (startYPos+rowPos) + 'px; background-color:' + LEDoffColor +'; height: 2px; width: 2px;font-size:2px;""></div>';" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "document.write(b);" & @CRLF
    $sPageSource &= "var columnCounter=0;   //keep track of postion of messageArray" & @CRLF
    $sPageSource &= "var bb=new Array();        //store particular LED's dom element here" & @CRLF
    $sPageSource &= "   if (NS) { for (var i=0; i<350; i++) { bb[i]=getCSS(""block""+i)}}" & @CRLF
    $sPageSource &= "   else {for (var i=0; i<350; i++){ bb[i]=getCSS(""block""+i).style;}}" & @CRLF
    $sPageSource &= "var isOn=new Array();for (var i=0; i<350; i++){ isOn[i]=0;}    //keep track on on/off status of particular LED" & @CRLF
    $sPageSource &= "onArray=new Array(); var onCount=0; //array size counter" & @CRLF
    $sPageSource &= "function scroll(){" & @CRLF
    $sPageSource &= "   onCount=0;" & @CRLF
    $sPageSource &= "   if (NS) { for (var i=0; i<301; i+=50){ if (isOn[i]==1) { bb[i].bgColor=LEDoffColor; isOn[i]=0;} for (var ii=1; ii<50; ii+=7){" & @CRLF
    $sPageSource &= "               temp=i+ii;temp1=temp+1;temp2=temp+2;temp3=temp+3;temp4=temp+4;temp5=temp+5;temp6=temp+6;" & @CRLF
    $sPageSource &= "               if (isOn[temp]==1) {bb[temp].bgColor=LEDoffColor;  isOn[temp]=0; bb[temp-1].bgColor=LEDonColor; isOn[temp-1]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp1]==1) {bb[temp1].bgColor=LEDoffColor;  isOn[temp1]=0; bb[temp].bgColor=LEDonColor; isOn[temp]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp2]==1) {bb[temp2].bgColor=LEDoffColor;  isOn[temp2]=0; bb[temp+1].bgColor=LEDonColor; isOn[temp+1]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp3]==1) {bb[temp3].bgColor=LEDoffColor;  isOn[temp3]=0; bb[temp2].bgColor=LEDonColor; isOn[temp2]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp4]==1) {bb[temp4].bgColor=LEDoffColor;  isOn[temp4]=0; bb[temp3].bgColor=LEDonColor; isOn[temp3]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp5]==1) {bb[temp5].bgColor=LEDoffColor;  isOn[temp5]=0; bb[temp4].bgColor=LEDonColor; isOn[temp4]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp6]==1) {bb[temp6].bgColor=LEDoffColor;  isOn[temp6]=0; bb[temp5].bgColor=LEDonColor; isOn[temp5]=1;}" & @CRLF
    $sPageSource &= "   }}}" & @CRLF
    $sPageSource &= "   else { for (var i=0; i<301; i+=50){ if (isOn[i]==1) { bb[i].backgroundColor=LEDoffColor; isOn[i]=0;} for (var ii=1; ii<50; ii+=7){" & @CRLF
    $sPageSource &= "               temp=i+ii;temp1=temp+1;temp2=temp+2;temp3=temp+3;temp4=temp+4;temp5=temp+5;temp6=temp+6;" & @CRLF
    $sPageSource &= "               if (isOn[temp]==1) {bb[temp].backgroundColor=LEDoffColor;  isOn[temp]=0; bb[temp-1].backgroundColor=LEDonColor; isOn[temp-1]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp1]==1) {bb[temp1].backgroundColor=LEDoffColor;  isOn[temp1]=0; bb[temp].backgroundColor=LEDonColor; isOn[temp]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp2]==1) {bb[temp2].backgroundColor=LEDoffColor;  isOn[temp2]=0; bb[temp+1].backgroundColor=LEDonColor; isOn[temp+1]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp3]==1) {bb[temp3].backgroundColor=LEDoffColor;  isOn[temp3]=0; bb[temp2].backgroundColor=LEDonColor; isOn[temp2]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp4]==1) {bb[temp4].backgroundColor=LEDoffColor;  isOn[temp4]=0; bb[temp3].backgroundColor=LEDonColor; isOn[temp3]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp5]==1) {bb[temp5].backgroundColor=LEDoffColor;  isOn[temp5]=0; bb[temp4].backgroundColor=LEDonColor; isOn[temp4]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp6]==1) {bb[temp6].backgroundColor=LEDoffColor;  isOn[temp6]=0; bb[temp5].backgroundColor=LEDonColor; isOn[temp5]=1;}" & @CRLF
    $sPageSource &= "   }}}" & @CRLF
    $sPageSource &= "   temp=messageArray[columnCounter]; flag=temp.charAt(0);//GET NEW COLUMN" & @CRLF
    $sPageSource &= "   if (temp.charAt(1)==""1"") {isOn[99]=1;} if (temp.charAt(2)==""1"") {isOn[149]=1} if (temp.charAt(3)==""1"") {isOn[199]=1}" & @CRLF
    $sPageSource &= "   if (temp.charAt(4)==""1"") {isOn[249]=1} if (temp.charAt(5)==""1"") {isOn[299]=1} if (temp.charAt(6)==""1"") {isOn[349]=1}" & @CRLF
    $sPageSource &= "   if (flag==""0"") {} else if (flag==""1"") {isOn[49]=1;} else if (flag==""X"") {pauseScroll();} else if (flag==""Y"") {flashScroll();}" & @CRLF
    $sPageSource &= "   else if (flag==""D"") {dropEffect();} else if (flag==""S"") {sunRiseEffect();} else if (flag==""Q"") {splitEffect();}" & @CRLF
    $sPageSource &= "   columnCounter++; if(columnCounter==columnCount) columnCounter=0;" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "//______________pause effect________________" & @CRLF
    $sPageSource &= "function pauseScroll(){ clearInterval(loop); setTimeout(""LEDinit()"",3000);}" & @CRLF
    $sPageSource &= "//______________onArray Section_____________" & @CRLF
    $sPageSource &= "onArray=new Array(); var onCount=0; //array size counter" & @CRLF
    $sPageSource &= "function makeOnArray(){ clearInterval(loop); onCount=0;    for (var i=0; i<700; i++){if (isOn[i]==1) {onArray[onCount]=i; onCount++;};}//make onArray of 'on' LEDS" & @CRLF
    $sPageSource &= "}//_________________________________" & @CRLF
    $sPageSource &= "//_______________flash effect_______________" & @CRLF
    $sPageSource &= "var flashCount=0;" & @CRLF
    $sPageSource &= "function flashScroll(){    makeOnArray(); flashCount=0; if (NS) {setTimeout(""flashItNS()"",250);} else {setTimeout(""flashIt()"",250);}}" & @CRLF
    $sPageSource &= "function flashItNS(){ flashCount++;" & @CRLF
    $sPageSource &= "   if (flashCount<14) {" & @CRLF
    $sPageSource &= "       if (flashCount % 2 == 0){ for (var i=0; i<onCount; i++){ isOn[onArray[i]]=0;bb[onArray[i]].bgColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "       else {for (var i=0; i<onCount; i++){isOn[onArray[i]]=1;bb[onArray[i]].bgColor=LEDonColor;}}" & @CRLF
    $sPageSource &= "       setTimeout(""flashItNS()"",250);" & @CRLF
    $sPageSource &= "   }" & @CRLF
    $sPageSource &= "   else {flashCount=0; setTimeout(""LEDinit()"",250);}" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "function flashIt(){ flashCount++;" & @CRLF
    $sPageSource &= "   if (flashCount<14) {" & @CRLF
    $sPageSource &= "       if (flashCount % 2 == 0){ for (var i=0; i<onCount; i++){ isOn[onArray[i]]=0;bb[onArray[i]].backgroundColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "       else {for (var i=0; i<onCount; i++){isOn[onArray[i]]=1;bb[onArray[i]].backgroundColor=LEDonColor;}}" & @CRLF
    $sPageSource &= "       setTimeout(""flashIt()"",250);" & @CRLF
    $sPageSource &= "   }" & @CRLF
    $sPageSource &= "   else {flashCount=0; setTimeout(""LEDinit()"",250);}" & @CRLF
    $sPageSource &= "}//_________________________________" & @CRLF
    $sPageSource &= "//____________scroll up effect______________" & @CRLF
    $sPageSource &= "dropArray=new Array();" & @CRLF
    $sPageSource &= "function dropEffect(){makeOnArray(); for (var i=0; i<onCount; i++){ dropArray[i]=onArray[i]; } if (NS) {dropItNS();} else {dropIt();}}" & @CRLF
    $sPageSource &= "var dropCount=0;" & @CRLF
    $sPageSource &= "function dropItNS(){" & @CRLF
    $sPageSource &= "   if (dropCount<7){for (var i=0; i<onCount; i++){ bb[dropArray[i]].bgColor=LEDoffColor; }" & @CRLF
    $sPageSource &= "       for (var i=0; i<onCount; i++){ temp=dropArray[i]; temp-=50;if (temp<0) temp+=350;bb[temp].bgColor=LEDonColor; dropArray[i]=temp;}" & @CRLF
    $sPageSource &= "       dropCount++; setTimeout(""dropItNS()"",100);" & @CRLF
    $sPageSource &= "   } else {dropCount=0;setTimeout(""LEDinit()"",100);}" & @CRLF
    $sPageSource &= "}//_________________________________" & @CRLF
    $sPageSource &= "function dropIt(){" & @CRLF
    $sPageSource &= "   if (dropCount<7){ for (var i=0; i<onCount; i++){ bb[dropArray[i]].backgroundColor=LEDoffColor; }" & @CRLF
    $sPageSource &= "       for (var i=0; i<onCount; i++){ temp=dropArray[i]; temp-=50; if (temp<0) temp+=350; bb[temp].backgroundColor=LEDonColor; dropArray[i]=temp;}" & @CRLF
    $sPageSource &= "       dropCount++; setTimeout(""dropIt()"",100);" & @CRLF
    $sPageSource &= "   } else {dropCount=0;setTimeout(""LEDinit()"",100);}" & @CRLF
    $sPageSource &= "}//_________________________________" & @CRLF
    $sPageSource &= "//____________sunrise effect________________" & @CRLF
    $sPageSource &= "sunRiseCounter=0;sunRiseArray=new Array();" & @CRLF
    $sPageSource &= "sunRiseArray[0]=new Array(50,101,102,103,154,155,156,207,208,259,260,261,212,163,164,115,116,117,168,169,170,221,222,223,274,275,276,227,228,179,180,131,132,83,134,135,186,187,238,239,240,241,292,293,344,295,296,247,198);//Hills" & @CRLF
    $sPageSource &= "sunRiseArray[1]=new Array(224,225,226); sunRiseArray[2]=new Array(174,175,176,177); sunRiseArray[3]=new Array(173,124,125,126,127,128,178); sunRiseArray[4]=new Array(172,123,74,75,76,77,129); sunRiseArray[5]=new Array(171,122,73,24,25,26,27,78,79,130);" & @CRLF
    $sPageSource &= "function sunRiseEffect() { makeOnArray(); for (var i=0; i<onCount; i++){ isOn[onArray[i]]=0; if (!NS) {bb[onArray[i]].backgroundColor=LEDoffColor;}    else {bb[onArray[i]].bgColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "   setTimeout(""riseEffectUp()"",1000);}" & @CRLF
    $sPageSource &= "function riseEffectUp() {" & @CRLF
    $sPageSource &= "   if (!NS) { for (var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++) {isOn[sunRiseArray[sunRiseCounter][ii]]=1;bb[sunRiseArray[sunRiseCounter][ii]].backgroundColor=LEDonColor;}}" & @CRLF
    $sPageSource &= "   else {for (var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++) {isOn[sunRiseArray[sunRiseCounter][ii]]=1;bb[sunRiseArray[sunRiseCounter][ii]].bgColor=LEDonColor;}}" & @CRLF
    $sPageSource &= "   sunRiseCounter++; if (sunRiseCounter>5) {sunRiseCounter=5;setTimeout(""riseEffectDown()"",2000);}   else {setTimeout(""riseEffectUp()"",250);}}" & @CRLF
    $sPageSource &= "function riseEffectDown() {" & @CRLF
    $sPageSource &= "   if (!NS) {for (var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++) {isOn[sunRiseArray[sunRiseCounter][ii]]=0;bb[sunRiseArray[sunRiseCounter][ii]].backgroundColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "   else {for (var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++) {isOn[sunRiseArray[sunRiseCounter][ii]]=0;bb[sunRiseArray[sunRiseCounter][ii]].bgColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "   sunRiseCounter--; if (sunRiseCounter<1) {sunRiseCounter=0;setTimeout(""LEDinit()"",1500);}" & @CRLF
    $sPageSource &= "   else {setTimeout(""riseEffectDown()"",250);}" & @CRLF
    $sPageSource &= "}//____________________________________" & @CRLF
    $sPageSource &= "//____________split scroll effect___________" & @CRLF
    $sPageSource &= "var splitCount=0;" & @CRLF
    $sPageSource &= "function splitEffect() { makeOnArray(); for (var i=0; i<onCount; i++) { dropArray[i]=onArray[i]; }" & @CRLF
    $sPageSource &= "   if (NS) {setTimeout(""splitNS()"",55);} else if (IE) {setTimeout(""splitIt()"",55);} else {setTimeout(""splitIt()"",100);}" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "function splitIt(){ for (i=0;i<onCount;i++){ temp=dropArray[i];" & @CRLF
    $sPageSource &= "   if (temp<150) { if (temp==100) {bb[temp].backgroundColor=LEDoffColor; temp=149; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==50) {bb[temp].backgroundColor=LEDoffColor; temp=99; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==0) {bb[temp].backgroundColor=LEDoffColor; temp=49; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else {bb[temp].backgroundColor=LEDoffColor; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           dropArray[i]=temp-1; }" & @CRLF
    $sPageSource &= "       else { if (temp==199) {bb[temp].backgroundColor=LEDoffColor; temp=200; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==349) {bb[temp].backgroundColor=LEDoffColor; temp=300; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==299) {bb[temp].backgroundColor=LEDoffColor; temp=250; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==249) {bb[temp].backgroundColor=LEDoffColor; temp=200; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else {bb[temp].backgroundColor=LEDoffColor; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           dropArray[i]=temp+1; }" & @CRLF
    $sPageSource &= "   } splitCount++; if (splitCount<49) {if (IE) {setTimeout(""splitIt()"",55);} else {setTimeout(""splitIt()"",100);} } else {splitCount=0; LEDinit();}" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "function splitNS(){" & @CRLF
    $sPageSource &= "   for (i=0;i<onCount;i++){ temp=dropArray[i];" & @CRLF
    $sPageSource &= "       if (temp<150) { if (temp==100) {bb[temp].bgColor=LEDoffColor; temp=149; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==50) {bb[temp].bgColor=LEDoffColor; temp=99; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==0) {bb[temp].bgColor=LEDoffColor; temp=49; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else {bb[temp].bgColor=LEDoffColor; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           dropArray[i]=temp-1; }" & @CRLF
    $sPageSource &= "       else { if (temp==199) {bb[temp].bgColor=LEDoffColor; temp=200; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==349) {bb[temp].bgColor=LEDoffColor; temp=300; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==299) {bb[temp].bgColor=LEDoffColor; temp=250; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==249) {bb[temp].bgColor=LEDoffColor; temp=200; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else {bb[temp].bgColor=LEDoffColor; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           dropArray[i]=temp+1; }" & @CRLF
    $sPageSource &= "   } splitCount++; if (splitCount<49) {setTimeout(""splitNS()"",55);} else {splitCount=0; LEDinit();}" & @CRLF
    $sPageSource &= "}//___________________________________" & @CRLF
    $sPageSource &= "function LEDinit(){if (NS) {loop=setInterval(""scroll()"",55);} else if (IE){loop=setInterval(""scroll()"",55);} else {loop=setInterval(""scroll()"",100);}}" & @CRLF
    $sPageSource &= "</SCRIPT>" & @CRLF
    $sPageSource &= "</BODY></HTML>" & @CRLF
    Return $sPageSource
EndFunc   ;==>_GetPage

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
Share on other sites

@Chimp the LED animation is awesome.

btw.
Did you try:
$oCoreWebView2.PostWebMessageAsString(.....)

and
$oCoreWebView2.ExecuteScriptAsync($sString) ; Method

??

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

When using the ObjCreateInterface() function, filling in method and property parameter types in the description tag string is the most time consuming job. The method and property names can be copied directly from the header file, WebView2.h, but the parameter types must be translated to corresponding AutoIt types. Therefore, in WV2Interfaces.au3 I've only filled in parameter types for the methods and properties that are actually used in the code. Since I've not used $oCoreWebView2.ExecuteScript() the parameter types are not filled in.

Replace at the top of WV2Interfaces.au3

"ExecuteScript hresult();"

with

"ExecuteScript hresult(wstr;ptr);"

Then replace in the code above

Case $Button1
  $oCoreWebView2.ExecuteScript("alert('Hello');")

with

Case $Button1
  $oCoreWebView2.ExecuteScript("alert('Hello');", NULL)
  Sleep(3000)
  $oCoreWebView2.NavigateToString(_GetPage())

or similar.

Link to comment
Share on other sites

It works, but to see the results the window should be maximized so $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED, $GUI_EVENT_RESTORE should be maintained

While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED, $GUI_EVENT_RESTORE
                Local $tRect = _WinAPI_GetClientRect($hGui)
                $oCoreWebView2Controller.put_Bounds($tRect)
            Case $Button1
                  $oCoreWebView2.ExecuteScript("alert('Hello');", NULL)
                  Sleep(3000)
                  $oCoreWebView2.NavigateToString(_GetPage())
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

This is an example to navigate and added all above features:

- Open DevTools

- Execute Scripts

- Get_Page

 

#AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#AutoIt3Wrapper_UseX64=y

Opt( "MustDeclareVars", 1 )

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPICom.au3>
#include <WinAPI.au3>
#include <Array.au3>

Global $hGui, $iTop = 40

#include "..\Includes\WV2Interfaces.au3"

HotKeySet("^+I", "DevTools") ; CTRL + SHIFT + I to open DevTools

WebView2()

Func WebView2()
    $hGui = GUICreate( "WebView2 Sample", 1200, 900, -1, -1, $WS_OVERLAPPEDWINDOW )

    Local $idButton_Back = GUICtrlCreateButton("Back", 10, 10, 70, 25)

    Local $idButton_Forward = GUICtrlCreateButton("Forward", 90, 10, 70, 25)

    Local $idButton_Home = GUICtrlCreateButton("Home", 170, 10, 70, 25)

    Local $idButton_Go = GUICtrlCreateButton("Go", 1140, 10, 45, 25)

    Local $idInput = GUICtrlCreateInput("", 250, 10, 850, 25)
    GUICtrlSetData(-1, "https://www.bing.com")

    _WinAPI_CoInitialize( $COINIT_APARTMENTTHREADED )

    CoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerCreate()
    ConsoleWrite( "$pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler = " & $pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler & @CRLF & @CRLF )

    CoreWebView2CreateCoreWebView2ControllerCompletedHandlerCreate()
    ConsoleWrite( "$pCoreWebView2CreateCoreWebView2ControllerCompletedHandler = " & $pCoreWebView2CreateCoreWebView2ControllerCompletedHandler & @CRLF & @CRLF )

    Local $hWebView2Loader = DllOpen( @AutoItX64 ? "WebView2Loader-x64.dll" : "WebView2Loader-x86.dll" )
    Local $aRet = DllCall( $hWebView2Loader, "long", "CreateCoreWebView2EnvironmentWithOptions", "wstr", "", "wstr", "", _
                           "ptr", NULL, "ptr", $pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler )
  If @error Or $aRet[0] Then Return ConsoleWrite( "CreateCoreWebView2EnvironmentWithOptions ERR" & @CRLF )
  ConsoleWrite( "CreateCoreWebView2EnvironmentWithOptions OK" & @CRLF & @CRLF )

    GUISetState( @SW_SHOW )

    ; HomePage
    Local $aArray_URL[1] = ["http://www.google.com"]
    Local $iIndex = 0

    ; Loop
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED, $GUI_EVENT_RESTORE
                Local $tRect = _WinAPI_GetClientRect( $hGui )
                          DllStructsetData($tRECT, "Top", $iTop)
                $oCoreWebView2Controller.put_Bounds( $tRect )

            Case $idButton_Go
                $oCoreWebView2.Navigate(GUICtrlRead($idInput))
                    _ArrayAdd($aArray_URL,GUICtrlRead($idInput))
                         $iIndex += 1
;~                  _ArrayDisplay($aArray_URL,"Go")

            Case $idButton_Back
                    If $iIndex > 0 Then
                        $iIndex -= 1
                    Else
                        $iIndex = 0
                    EndIf
                    $oCoreWebView2.Navigate($aArray_URL[$iIndex])
                     $oCoreWebView2.ExecuteScript("alert('Pressed Back');", NULL)
;~                  _ArrayDisplay($aArray_URL,"Back")

            Case $idButton_Forward
                    If $iIndex < _ArrayMaxIndex($aArray_URL)+1 Then
                        $iIndex +=1
                    EndIf
                    $oCoreWebView2.Navigate($aArray_URL[$iIndex])
                     $oCoreWebView2.ExecuteScript("alert('Pressed Forward');", NULL)
;~                  _ArrayDisplay($aArray_URL,"FW")

            Case $idButton_Home
                    $oCoreWebView2.Navigate($aArray_URL[0])

            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    CoreWebView2CreateCoreWebView2ControllerCompletedHandlerDelete()
    CoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerDelete()
    DllClose( $hWebView2Loader )
EndFunc

Func CoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_Invoke( $pSelf, $long, $ptr ) ; Ret: long  Par: long;ptr*
    ConsoleWrite( "CoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_Invoke" & @CRLF )
    $oCoreWebView2Environment = ObjCreateInterface( $ptr, $sIID_ICoreWebView2Environment, $dtag_ICoreWebView2Environment )
    ConsoleWrite( "IsObj( $oCoreWebView2Environment ) = " & IsObj( $oCoreWebView2Environment ) & @CRLF & @CRLF )
    $oCoreWebView2Environment.CreateCoreWebView2Controller( $hGui, $pCoreWebView2CreateCoreWebView2ControllerCompletedHandler )
    Return 0
    #forceref $pSelf, $long
EndFunc

Func CoreWebView2CreateCoreWebView2ControllerCompletedHandler_Invoke( $pSelf, $long, $ptr ) ; Ret: long  Par: long;ptr*
    ConsoleWrite( "CoreWebView2CreateCoreWebView2ControllerCompletedHandler_Invoke" & @CRLF )
    $oCoreWebView2Controller = ObjCreateInterface( $ptr, $sIID_ICoreWebView2Controller, $dtag_ICoreWebView2Controller )
    ConsoleWrite( "IsObj( $oCoreWebView2Controller ) = " & IsObj( $oCoreWebView2Controller ) & @CRLF )
    $oCoreWebView2Controller.AddRef()
    $oCoreWebView2Controller.get_CoreWebView2( $pCoreWebView2 )
    $oCoreWebView2 = ObjCreateInterface( $pCoreWebView2, $sIID_ICoreWebView2, $dtag_ICoreWebView2 )
    ConsoleWrite( "IsObj( $oCoreWebView2 ) = " & IsObj( $oCoreWebView2 ) & @CRLF & @CRLF )
    Local $tRect = _WinAPI_GetClientRect( $hGui )
                DllStructsetData($tRECT, "Top", $iTop)
    $oCoreWebView2Controller.put_Bounds( $tRect )

;~  Start Page
;~  $oCoreWebView2.Navigate( "https://www.google.com/" )
     $oCoreWebView2.NavigateToString(_GetPage())

    Return 0
    #forceref $pSelf, $long
EndFunc

Func DevTools()
    $oCoreWebView2.OpenDevToolsWindow()
EndFunc

Func _GetPage()
    Local $sPageSource = ""
    $sPageSource &= "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & @CRLF
    $sPageSource &= "<HTML><HEAD><TITLE>L E D Panel Script</TITLE>" & @CRLF
    $sPageSource &= "<META http-equiv=Content-Type content=""text/html; charset=windows-1252"">" & @CRLF
    $sPageSource &= "<STYLE type=text/css>" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "body{" & @CRLF
    $sPageSource &= "background-color:black;" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "</STYLE>" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "</HEAD>" & @CRLF
    $sPageSource &= "<BODY onload=""LEDinit()"">" & @CRLF
    $sPageSource &= "<img src=""https://www.autoitscript.com/forum/cdn/images/logo_autoit_210x72.svg"" width=""100"" height=""35"" style=""position: absolute; top: 5px; left: 200px;"">" & @CRLF
    $sPageSource &= "<SCRIPT language=JavaScript>" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "//""L.E.D. Panel"" Script by Richard Maloney © 2002" & @CRLF
    $sPageSource &= "//For Custom effects, email Richard (ottawo@rogers.com)" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "//____________________CONFIGURATION AREA_____________________" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "// THIS LED SCRIPT TAKES UP 200 pixels HORIZONTAL and 28 pixels VERTICAL -Have Fun :-)" & @CRLF
    $sPageSource &= "// YOUR MESSAGE GOES ON NEXT 4 LINES DOWN." & @CRLF
    $sPageSource &= "// ALLOWABLE CHARACTERS ARE: A-Z, Period, space, comma, numerals, question mark and 'message codes'." & @CRLF
    $sPageSource &= "// THE 4 MESSAGE CODES:" & @CRLF
    $sPageSource &= "// @=PAUSE FOR 3 SECONDS,  #=FLASH FOR 3 SECONDS, ^=SCROLL UP EFFECT, _=SUN EFFECT, $=SPLIT EFFECT" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "//EXAMPLE: var message=""_  Dynamic^^   Drive!  #  For  the best dhtml scripts...    www.dynamic.drive.com    "";" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "var message=""HI EVERYONE@ LARSJ HAS DONE A VERY GOOD JOB#       WEBVIEW2^^ A POWERFUL TOOL !!!@$@    A NEW SUN HAS RISEN@_     "";" & @CRLF
    $sPageSource &= "var LEDonColor='Red';        //color of the LEDs when they are on" & @CRLF
    $sPageSource &= "var LEDoffColor='#7D0605';   //color of the LEDs when they are off" & @CRLF
    $sPageSource &= "startXPos=10;               //start of horizontal position eg. startXPos=20; places the leds 20 pixels from left" & @CRLF
    $sPageSource &= "startYPos=10;              //start of vertical position" & @CRLF
    $sPageSource &= "//____________________END CONFIGURATION AREA__________________" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "var IE=(document.all) ? true:false; var NS=(document.layers) ? true:false; var W3C=((document.getElementById) && (!IE)) ? true:false;" & @CRLF
    $sPageSource &= "var d=document; if (window.offscreenBuffering) window.offscreenBuffering = true;" & @CRLF
    $sPageSource &= "function getCSS(id) {" & @CRLF
    $sPageSource &= "   if (IE)      return d.all[id]           //IE" & @CRLF
    $sPageSource &= "   else if (NS) return d.layers[id]        //NS4" & @CRLF
    $sPageSource &= "   else         return d.getElementById(id)//W3C" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "var alphabet=new Array(44);" & @CRLF
    $sPageSource &= "alphabet[0]=new Array(""0111111"",""1001000"",""1001000"",""1001000"",""0111111"");    alphabet[1]=new Array(""1111111"",""1001001"",""1001001"",""1001001"",""0110110"");//B" & @CRLF
    $sPageSource &= "alphabet[2]=new Array(""0111110"",""1000001"",""1000001"",""1000001"",""0100010"");    alphabet[3]=new Array(""1111111"",""1000001"",""1000001"",""1000001"",""0111110"");//D" & @CRLF
    $sPageSource &= "alphabet[4]=new Array(""1111111"",""1001001"",""1001001"",""1001001"");                alphabet[5]=new Array(""1111111"",""1001000"",""1001000"",""1001000"");//F" & @CRLF
    $sPageSource &= "alphabet[6]=new Array(""0111110"",""1000001"",""1000001"",""1001001"",""0101110"");    alphabet[7]=new Array(""1111111"",""0001000"",""0001000"",""0001000"",""1111111"");//H" & @CRLF
    $sPageSource &= "alphabet[8]=new Array(""1000001"",""1111111"",""1000001"");                        alphabet[9]=new Array(""0000110"",""0000001"",""0000001"",""0000001"",""1111110"");//J" & @CRLF
    $sPageSource &= "alphabet[10]=new Array(""1111111"",""0001000"",""0010100"",""0100010"",""1000001"");   alphabet[11]=new Array(""1111111"",""0000001"",""0000001"",""0000001"");//L" & @CRLF
    $sPageSource &= "alphabet[12]=new Array(""1111111"",""0010000"",""0001000"",""0010000"",""1111111"");   alphabet[13]=new Array(""1111111"",""0010000"",""0001000"",""0000100"",""1111111"");//N" & @CRLF
    $sPageSource &= "alphabet[14]=new Array(""0111110"",""1000001"",""1000001"",""1000001"",""0111110"");   alphabet[15]=new Array(""1111111"",""1001000"",""1001000"",""1001000"",""0110000"");//P" & @CRLF
    $sPageSource &= "alphabet[16]=new Array(""0111110"",""1000001"",""1000001"",""1000011"",""0111111"");   alphabet[17]=new Array(""1111111"",""1001000"",""1001100"",""1001010"",""0110001"");//R" & @CRLF
    $sPageSource &= "alphabet[18]=new Array(""0110010"",""1001001"",""1001001"",""1001001"",""0100110"");   alphabet[19]=new Array(""1000000"",""1000000"",""1111111"",""1000000"",""1000000"");//T" & @CRLF
    $sPageSource &= "alphabet[20]=new Array(""1111110"",""0000001"",""0000001"",""0000001"",""1111110"");   alphabet[21]=new Array(""1110000"",""0001100"",""0000011"",""0001100"",""1110000"");//V" & @CRLF
    $sPageSource &= "alphabet[22]=new Array(""1111110"",""0000001"",""0000010"",""0001100"",""0000010"",""0000001"",""1111110""); alphabet[23]=new Array(""1100011"",""0010100"",""0001000"",""0010100"",""1100011"");//X" & @CRLF
    $sPageSource &= "alphabet[24]=new Array(""1100000"",""0010000"",""0001111"",""0010000"",""1100000"");   alphabet[25]=new Array(""1000011"",""1000101"",""1001001"",""1010001"",""1100001"");//Z" & @CRLF
    $sPageSource &= "alphabet[26]=new Array(""0000000"",""0000000"",""0000000"",""0000000"");           alphabet[27]=new Array(""0000000"",""0000001"",""0000000"",""0000000"",""0000000"");//PERIOD" & @CRLF
    $sPageSource &= "alphabet[28]=new Array(""0000000"",""0000000"",""1111101"",""0000000"",""0000000"");//!" & @CRLF
    $sPageSource &= "alphabet[29]=new Array(""0100001"",""1111111"",""0000001"");                       alphabet[30]=new Array(""0100011"",""1000101"",""1001001"",""1001001"",""0110001"");//2" & @CRLF
    $sPageSource &= "alphabet[31]=new Array(""0100010"",""1001001"",""1001001"",""1001001"",""0110110"");   alphabet[32]=new Array(""0001000"",""0011000"",""0101000"",""1111111"",""0001000"");//4" & @CRLF
    $sPageSource &= "alphabet[33]=new Array(""1111001"",""1001001"",""1001001"",""1001001"",""1000110"");   alphabet[34]=new Array(""0111110"",""1001001"",""1001001"",""1001001"",""0100110"");//6" & @CRLF
    $sPageSource &= "alphabet[35]=new Array(""1000011"",""1000100"",""1001000"",""1110000"");           alphabet[36]=new Array(""0110110"",""1001001"",""1001001"",""1001001"",""0110110"");//8" & @CRLF
    $sPageSource &= "alphabet[37]=new Array(""0110010"",""1001001"",""1001001"",""1001001"",""0111110"");   alphabet[38]=new Array(""0000001"",""0000010"",""0000000"");//COMMA" & @CRLF
    $sPageSource &= "alphabet[39]=new Array(""XXXXXXX"");//PAUSE ( @ )" & @CRLF
    $sPageSource &= "alphabet[40]=new Array(""YYYYYYY"");//FLASH ( # )" & @CRLF
    $sPageSource &= "alphabet[41]=new Array(""DDDDDDD"");//SCROLL UP EFFECT ( ^ )" & @CRLF
    $sPageSource &= "alphabet[42]=new Array(""SSSSSSS"");//SUN EFFECT ( _ )" & @CRLF
    $sPageSource &= "alphabet[43]=new Array(""0100000"",""1000000"",""1001101"",""1001000"",""0110000"");//?" & @CRLF
    $sPageSource &= "alphabet[44]=new Array(""QQQQQQQ"");//SPLIT EFFECT ( $ )" & @CRLF
    $sPageSource &= "" & @CRLF
    $sPageSource &= "message=message.toUpperCase();                 //make message uppercase" & @CRLF
    $sPageSource &= "var messageArray=new Array();                  //make messageArray-an array of the letters in the message" & @CRLF
    $sPageSource &= "var columnCount=0;                                 //variable to count columns in messageArray.length" & @CRLF
    $sPageSource &= "for (i=0; i<message.length; i++){              //iterate through the characters in the message" & @CRLF
    $sPageSource &= "   letterNum=message.charCodeAt(i);            //assign proper letter code (alphabet array)" & @CRLF
    $sPageSource &= "   if ((letterNum>=65) && (letterNum<=90)) temp=letterNum-65; //letters" & @CRLF
    $sPageSource &= "   else if (letterNum==46) temp=27;            //." & @CRLF
    $sPageSource &= "   else if (letterNum==32) temp=26;            //space" & @CRLF
    $sPageSource &= "   else if (letterNum==33) temp=28;            //!" & @CRLF
    $sPageSource &= "   else if ((letterNum>=49) && (letterNum<=57)) temp=letterNum-20; //[1-9]" & @CRLF
    $sPageSource &= "   else if (letterNum==48) temp=14;            //zero" & @CRLF
    $sPageSource &= "   else if (letterNum==63) temp=43;            //?" & @CRLF
    $sPageSource &= "   else if (letterNum==44) temp=38;            //," & @CRLF
    $sPageSource &= "   else if (letterNum==64) temp=39;            //pause" & @CRLF
    $sPageSource &= "   else if (letterNum==35) temp=40;            //flash effect" & @CRLF
    $sPageSource &= "   else if (letterNum==94) temp=41;            //scroll up effect" & @CRLF
    $sPageSource &= "   else if (letterNum==95) temp=42;            //sunrise effect" & @CRLF
    $sPageSource &= "   else if (letterNum==36) temp=44;            //split effect" & @CRLF
    $sPageSource &= "   else continue;" & @CRLF
    $sPageSource &= "   for (ii=0; ii<alphabet[temp].length;ii++){ messageArray[columnCount]=alphabet[temp][ii];columnCount++;}" & @CRLF
    $sPageSource &= "   if ((temp!=39) && (temp!=40) && (temp!=41)) {messageArray[columnCount]=""0000000"";columnCount++;}" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "//make 'led screen' with block 0-49 on row 1, block 50-99 on row 2, block 100-149 on row 3, etc.." & @CRLF
    $sPageSource &= "var b='';" & @CRLF
    $sPageSource &= "for (var i=0; i<350; i++){//columns 50 columns x 7 rows" & @CRLF
    $sPageSource &= "   rowPos=0+3*(i>49)+3*(i>99)+3*(i>149)+3*(i>199)+3*(i>249)+3*(i>299);" & @CRLF
    $sPageSource &= "   colPos=0+150*(i>49)+150*(i>99)+150*(i>149)+150*(i>199)+150*(i>249)+150*(i>299);" & @CRLF
    $sPageSource &= "   b+= (NS) ? '<LAYER NAME=""block' + i + '"" LEFT=""' + (startXPos+i*3-colPos) + '"" TOP=""' + (startYPos+rowPos) + '"" VISIBILITY=""show"" WIDTH=""2"" HEIGHT=""2"" BGCOLOR=""' + LEDoffColor + '""></LAYER>' : '<div id=""block' + i + '"" style=""position:absolute; left:' + (startXPos+i*3-colPos) + 'px; top:' + (startYPos+rowPos) + 'px; background-color:' + LEDoffColor +'; height: 2px; width: 2px;font-size:2px;""></div>';" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "document.write(b);" & @CRLF
    $sPageSource &= "var columnCounter=0;   //keep track of postion of messageArray" & @CRLF
    $sPageSource &= "var bb=new Array();        //store particular LED's dom element here" & @CRLF
    $sPageSource &= "   if (NS) { for (var i=0; i<350; i++) { bb[i]=getCSS(""block""+i)}}" & @CRLF
    $sPageSource &= "   else {for (var i=0; i<350; i++){ bb[i]=getCSS(""block""+i).style;}}" & @CRLF
    $sPageSource &= "var isOn=new Array();for (var i=0; i<350; i++){ isOn[i]=0;}    //keep track on on/off status of particular LED" & @CRLF
    $sPageSource &= "onArray=new Array(); var onCount=0; //array size counter" & @CRLF
    $sPageSource &= "function scroll(){" & @CRLF
    $sPageSource &= "   onCount=0;" & @CRLF
    $sPageSource &= "   if (NS) { for (var i=0; i<301; i+=50){ if (isOn[i]==1) { bb[i].bgColor=LEDoffColor; isOn[i]=0;} for (var ii=1; ii<50; ii+=7){" & @CRLF
    $sPageSource &= "               temp=i+ii;temp1=temp+1;temp2=temp+2;temp3=temp+3;temp4=temp+4;temp5=temp+5;temp6=temp+6;" & @CRLF
    $sPageSource &= "               if (isOn[temp]==1) {bb[temp].bgColor=LEDoffColor;  isOn[temp]=0; bb[temp-1].bgColor=LEDonColor; isOn[temp-1]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp1]==1) {bb[temp1].bgColor=LEDoffColor;  isOn[temp1]=0; bb[temp].bgColor=LEDonColor; isOn[temp]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp2]==1) {bb[temp2].bgColor=LEDoffColor;  isOn[temp2]=0; bb[temp+1].bgColor=LEDonColor; isOn[temp+1]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp3]==1) {bb[temp3].bgColor=LEDoffColor;  isOn[temp3]=0; bb[temp2].bgColor=LEDonColor; isOn[temp2]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp4]==1) {bb[temp4].bgColor=LEDoffColor;  isOn[temp4]=0; bb[temp3].bgColor=LEDonColor; isOn[temp3]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp5]==1) {bb[temp5].bgColor=LEDoffColor;  isOn[temp5]=0; bb[temp4].bgColor=LEDonColor; isOn[temp4]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp6]==1) {bb[temp6].bgColor=LEDoffColor;  isOn[temp6]=0; bb[temp5].bgColor=LEDonColor; isOn[temp5]=1;}" & @CRLF
    $sPageSource &= "   }}}" & @CRLF
    $sPageSource &= "   else { for (var i=0; i<301; i+=50){ if (isOn[i]==1) { bb[i].backgroundColor=LEDoffColor; isOn[i]=0;} for (var ii=1; ii<50; ii+=7){" & @CRLF
    $sPageSource &= "               temp=i+ii;temp1=temp+1;temp2=temp+2;temp3=temp+3;temp4=temp+4;temp5=temp+5;temp6=temp+6;" & @CRLF
    $sPageSource &= "               if (isOn[temp]==1) {bb[temp].backgroundColor=LEDoffColor;  isOn[temp]=0; bb[temp-1].backgroundColor=LEDonColor; isOn[temp-1]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp1]==1) {bb[temp1].backgroundColor=LEDoffColor;  isOn[temp1]=0; bb[temp].backgroundColor=LEDonColor; isOn[temp]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp2]==1) {bb[temp2].backgroundColor=LEDoffColor;  isOn[temp2]=0; bb[temp+1].backgroundColor=LEDonColor; isOn[temp+1]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp3]==1) {bb[temp3].backgroundColor=LEDoffColor;  isOn[temp3]=0; bb[temp2].backgroundColor=LEDonColor; isOn[temp2]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp4]==1) {bb[temp4].backgroundColor=LEDoffColor;  isOn[temp4]=0; bb[temp3].backgroundColor=LEDonColor; isOn[temp3]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp5]==1) {bb[temp5].backgroundColor=LEDoffColor;  isOn[temp5]=0; bb[temp4].backgroundColor=LEDonColor; isOn[temp4]=1;}" & @CRLF
    $sPageSource &= "               if (isOn[temp6]==1) {bb[temp6].backgroundColor=LEDoffColor;  isOn[temp6]=0; bb[temp5].backgroundColor=LEDonColor; isOn[temp5]=1;}" & @CRLF
    $sPageSource &= "   }}}" & @CRLF
    $sPageSource &= "   temp=messageArray[columnCounter]; flag=temp.charAt(0);//GET NEW COLUMN" & @CRLF
    $sPageSource &= "   if (temp.charAt(1)==""1"") {isOn[99]=1;} if (temp.charAt(2)==""1"") {isOn[149]=1} if (temp.charAt(3)==""1"") {isOn[199]=1}" & @CRLF
    $sPageSource &= "   if (temp.charAt(4)==""1"") {isOn[249]=1} if (temp.charAt(5)==""1"") {isOn[299]=1} if (temp.charAt(6)==""1"") {isOn[349]=1}" & @CRLF
    $sPageSource &= "   if (flag==""0"") {} else if (flag==""1"") {isOn[49]=1;} else if (flag==""X"") {pauseScroll();} else if (flag==""Y"") {flashScroll();}" & @CRLF
    $sPageSource &= "   else if (flag==""D"") {dropEffect();} else if (flag==""S"") {sunRiseEffect();} else if (flag==""Q"") {splitEffect();}" & @CRLF
    $sPageSource &= "   columnCounter++; if(columnCounter==columnCount) columnCounter=0;" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "//______________pause effect________________" & @CRLF
    $sPageSource &= "function pauseScroll(){ clearInterval(loop); setTimeout(""LEDinit()"",3000);}" & @CRLF
    $sPageSource &= "//______________onArray Section_____________" & @CRLF
    $sPageSource &= "onArray=new Array(); var onCount=0; //array size counter" & @CRLF
    $sPageSource &= "function makeOnArray(){ clearInterval(loop); onCount=0;    for (var i=0; i<700; i++){if (isOn[i]==1) {onArray[onCount]=i; onCount++;};}//make onArray of 'on' LEDS" & @CRLF
    $sPageSource &= "}//_________________________________" & @CRLF
    $sPageSource &= "//_______________flash effect_______________" & @CRLF
    $sPageSource &= "var flashCount=0;" & @CRLF
    $sPageSource &= "function flashScroll(){    makeOnArray(); flashCount=0; if (NS) {setTimeout(""flashItNS()"",250);} else {setTimeout(""flashIt()"",250);}}" & @CRLF
    $sPageSource &= "function flashItNS(){ flashCount++;" & @CRLF
    $sPageSource &= "   if (flashCount<14) {" & @CRLF
    $sPageSource &= "       if (flashCount % 2 == 0){ for (var i=0; i<onCount; i++){ isOn[onArray[i]]=0;bb[onArray[i]].bgColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "       else {for (var i=0; i<onCount; i++){isOn[onArray[i]]=1;bb[onArray[i]].bgColor=LEDonColor;}}" & @CRLF
    $sPageSource &= "       setTimeout(""flashItNS()"",250);" & @CRLF
    $sPageSource &= "   }" & @CRLF
    $sPageSource &= "   else {flashCount=0; setTimeout(""LEDinit()"",250);}" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "function flashIt(){ flashCount++;" & @CRLF
    $sPageSource &= "   if (flashCount<14) {" & @CRLF
    $sPageSource &= "       if (flashCount % 2 == 0){ for (var i=0; i<onCount; i++){ isOn[onArray[i]]=0;bb[onArray[i]].backgroundColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "       else {for (var i=0; i<onCount; i++){isOn[onArray[i]]=1;bb[onArray[i]].backgroundColor=LEDonColor;}}" & @CRLF
    $sPageSource &= "       setTimeout(""flashIt()"",250);" & @CRLF
    $sPageSource &= "   }" & @CRLF
    $sPageSource &= "   else {flashCount=0; setTimeout(""LEDinit()"",250);}" & @CRLF
    $sPageSource &= "}//_________________________________" & @CRLF
    $sPageSource &= "//____________scroll up effect______________" & @CRLF
    $sPageSource &= "dropArray=new Array();" & @CRLF
    $sPageSource &= "function dropEffect(){makeOnArray(); for (var i=0; i<onCount; i++){ dropArray[i]=onArray[i]; } if (NS) {dropItNS();} else {dropIt();}}" & @CRLF
    $sPageSource &= "var dropCount=0;" & @CRLF
    $sPageSource &= "function dropItNS(){" & @CRLF
    $sPageSource &= "   if (dropCount<7){for (var i=0; i<onCount; i++){ bb[dropArray[i]].bgColor=LEDoffColor; }" & @CRLF
    $sPageSource &= "       for (var i=0; i<onCount; i++){ temp=dropArray[i]; temp-=50;if (temp<0) temp+=350;bb[temp].bgColor=LEDonColor; dropArray[i]=temp;}" & @CRLF
    $sPageSource &= "       dropCount++; setTimeout(""dropItNS()"",100);" & @CRLF
    $sPageSource &= "   } else {dropCount=0;setTimeout(""LEDinit()"",100);}" & @CRLF
    $sPageSource &= "}//_________________________________" & @CRLF
    $sPageSource &= "function dropIt(){" & @CRLF
    $sPageSource &= "   if (dropCount<7){ for (var i=0; i<onCount; i++){ bb[dropArray[i]].backgroundColor=LEDoffColor; }" & @CRLF
    $sPageSource &= "       for (var i=0; i<onCount; i++){ temp=dropArray[i]; temp-=50; if (temp<0) temp+=350; bb[temp].backgroundColor=LEDonColor; dropArray[i]=temp;}" & @CRLF
    $sPageSource &= "       dropCount++; setTimeout(""dropIt()"",100);" & @CRLF
    $sPageSource &= "   } else {dropCount=0;setTimeout(""LEDinit()"",100);}" & @CRLF
    $sPageSource &= "}//_________________________________" & @CRLF
    $sPageSource &= "//____________sunrise effect________________" & @CRLF
    $sPageSource &= "sunRiseCounter=0;sunRiseArray=new Array();" & @CRLF
    $sPageSource &= "sunRiseArray[0]=new Array(50,101,102,103,154,155,156,207,208,259,260,261,212,163,164,115,116,117,168,169,170,221,222,223,274,275,276,227,228,179,180,131,132,83,134,135,186,187,238,239,240,241,292,293,344,295,296,247,198);//Hills" & @CRLF
    $sPageSource &= "sunRiseArray[1]=new Array(224,225,226); sunRiseArray[2]=new Array(174,175,176,177); sunRiseArray[3]=new Array(173,124,125,126,127,128,178); sunRiseArray[4]=new Array(172,123,74,75,76,77,129); sunRiseArray[5]=new Array(171,122,73,24,25,26,27,78,79,130);" & @CRLF
    $sPageSource &= "function sunRiseEffect() { makeOnArray(); for (var i=0; i<onCount; i++){ isOn[onArray[i]]=0; if (!NS) {bb[onArray[i]].backgroundColor=LEDoffColor;}    else {bb[onArray[i]].bgColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "   setTimeout(""riseEffectUp()"",1000);}" & @CRLF
    $sPageSource &= "function riseEffectUp() {" & @CRLF
    $sPageSource &= "   if (!NS) { for (var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++) {isOn[sunRiseArray[sunRiseCounter][ii]]=1;bb[sunRiseArray[sunRiseCounter][ii]].backgroundColor=LEDonColor;}}" & @CRLF
    $sPageSource &= "   else {for (var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++) {isOn[sunRiseArray[sunRiseCounter][ii]]=1;bb[sunRiseArray[sunRiseCounter][ii]].bgColor=LEDonColor;}}" & @CRLF
    $sPageSource &= "   sunRiseCounter++; if (sunRiseCounter>5) {sunRiseCounter=5;setTimeout(""riseEffectDown()"",2000);}   else {setTimeout(""riseEffectUp()"",250);}}" & @CRLF
    $sPageSource &= "function riseEffectDown() {" & @CRLF
    $sPageSource &= "   if (!NS) {for (var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++) {isOn[sunRiseArray[sunRiseCounter][ii]]=0;bb[sunRiseArray[sunRiseCounter][ii]].backgroundColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "   else {for (var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++) {isOn[sunRiseArray[sunRiseCounter][ii]]=0;bb[sunRiseArray[sunRiseCounter][ii]].bgColor=LEDoffColor;}}" & @CRLF
    $sPageSource &= "   sunRiseCounter--; if (sunRiseCounter<1) {sunRiseCounter=0;setTimeout(""LEDinit()"",1500);}" & @CRLF
    $sPageSource &= "   else {setTimeout(""riseEffectDown()"",250);}" & @CRLF
    $sPageSource &= "}//____________________________________" & @CRLF
    $sPageSource &= "//____________split scroll effect___________" & @CRLF
    $sPageSource &= "var splitCount=0;" & @CRLF
    $sPageSource &= "function splitEffect() { makeOnArray(); for (var i=0; i<onCount; i++) { dropArray[i]=onArray[i]; }" & @CRLF
    $sPageSource &= "   if (NS) {setTimeout(""splitNS()"",55);} else if (IE) {setTimeout(""splitIt()"",55);} else {setTimeout(""splitIt()"",100);}" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "function splitIt(){ for (i=0;i<onCount;i++){ temp=dropArray[i];" & @CRLF
    $sPageSource &= "   if (temp<150) { if (temp==100) {bb[temp].backgroundColor=LEDoffColor; temp=149; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==50) {bb[temp].backgroundColor=LEDoffColor; temp=99; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==0) {bb[temp].backgroundColor=LEDoffColor; temp=49; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else {bb[temp].backgroundColor=LEDoffColor; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           dropArray[i]=temp-1; }" & @CRLF
    $sPageSource &= "       else { if (temp==199) {bb[temp].backgroundColor=LEDoffColor; temp=200; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==349) {bb[temp].backgroundColor=LEDoffColor; temp=300; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==299) {bb[temp].backgroundColor=LEDoffColor; temp=250; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==249) {bb[temp].backgroundColor=LEDoffColor; temp=200; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else {bb[temp].backgroundColor=LEDoffColor; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           dropArray[i]=temp+1; }" & @CRLF
    $sPageSource &= "   } splitCount++; if (splitCount<49) {if (IE) {setTimeout(""splitIt()"",55);} else {setTimeout(""splitIt()"",100);} } else {splitCount=0; LEDinit();}" & @CRLF
    $sPageSource &= "}" & @CRLF
    $sPageSource &= "function splitNS(){" & @CRLF
    $sPageSource &= "   for (i=0;i<onCount;i++){ temp=dropArray[i];" & @CRLF
    $sPageSource &= "       if (temp<150) { if (temp==100) {bb[temp].bgColor=LEDoffColor; temp=149; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==50) {bb[temp].bgColor=LEDoffColor; temp=99; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==0) {bb[temp].bgColor=LEDoffColor; temp=49; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else {bb[temp].bgColor=LEDoffColor; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           dropArray[i]=temp-1; }" & @CRLF
    $sPageSource &= "       else { if (temp==199) {bb[temp].bgColor=LEDoffColor; temp=200; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==349) {bb[temp].bgColor=LEDoffColor; temp=300; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==299) {bb[temp].bgColor=LEDoffColor; temp=250; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else if (temp==249) {bb[temp].bgColor=LEDoffColor; temp=200; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           else {bb[temp].bgColor=LEDoffColor; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
    $sPageSource &= "           dropArray[i]=temp+1; }" & @CRLF
    $sPageSource &= "   } splitCount++; if (splitCount<49) {setTimeout(""splitNS()"",55);} else {splitCount=0; LEDinit();}" & @CRLF
    $sPageSource &= "}//___________________________________" & @CRLF
    $sPageSource &= "function LEDinit(){if (NS) {loop=setInterval(""scroll()"",55);} else if (IE){loop=setInterval(""scroll()"",55);} else {loop=setInterval(""scroll()"",100);}}" & @CRLF
    $sPageSource &= "</SCRIPT>" & @CRLF
    $sPageSource &= "</BODY></HTML>" & @CRLF
    Return $sPageSource
EndFunc   ;==>_GetPage

 

Navigation is not 100% yet but it a good start for all of them who want to dive deeper into it.

Correction : Navigation

 

Edited by ptrex
Link to comment
Share on other sites

10 hours ago, LarsJ said:

... the parameter types must be translated to corresponding AutoIt types.

well, I got it. Thanks for the illuminating explanation! :graduated:
So WV2Interfaces.au3 is still under construction. If I were able I could collaborate in compiling those parameters, but I'm afraid I would do more harm than good ...
I think this ExecuteScript function is very useful. I'm sorry, I hope I'm not too boring, but I would be interested in understanding how to set up for this function also the part related to receiving the result of the script that has been executed, that is; ExecuteScript(LPCWSTR javaScript, ICoreWebView2ExecuteScriptCompletedHandler *handler), so to be able to use the related callback function in our script.
Thanks so much again for any help

P.S.
In my previous post I've embedded in the script a quite long Html listing. Well, if  someone is interested, I've used an easy and quick way to generate that ready to be pasted in the AutoIt script
1) Find the the HTML/Javascript listing that you want to embedd in your AutoIt listing and copy it to the clipboard. (that is select it and hit ctrl-c)
2) run this little snippet, It reads the listing that is in the clipboard, prepare it for the pasting and, after the tranformation, puts it again in the clipboard.

Local $sFuntionName = "_GetSource"
Local $sVarName = "$sSource"
Local $aStr = StringSplit(ClipGet(), @CRLF, 1) ;  get the clipboard content

Local $sListing = "Func " & $sFuntionName & "()" & @CRLF
$sListing &= 'Local ' & $sVarName & ' = ""' & @CRLF
For $i = 1 To $aStr[0]
    $sListing &= $sVarName & ' &= "' & StringReplace($aStr[$i], '"', '""') & '" & @CRLF' & @CRLF
Next
$sListing &= "Return " & $sVarName & @CRLF
$sListing &= "EndFunc"
ClipPut($sListing)
; ConsoleWrite($sListing)

3) paste the clipboard in your listing (hit ctrl-v)

have fun

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
Share on other sites

Scripting example based on code by Chimp
WebView2-4.au3:

#AutoIt3Wrapper_Au3Check_Parameters=-d -w- 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

#AutoIt3Wrapper_UseX64=y

Opt( "MustDeclareVars", 1 )

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPICom.au3>
#include <WinAPI.au3>

Global $hGui

; Project includes
#include "..\Includes\WV2Interfaces.au3"

WebView2()

Func WebView2()
  ; Create WebView2 GUI
  $hGui = GUICreate( "WebView2 Sample", 600, 300, -1, -1, $WS_OVERLAPPEDWINDOW )

  ; Create Button
  Local $idButton = GUICtrlCreateButton( "ExecuteScript", 10, 250, 170, 40 )

  ; Initialize COM
  _WinAPI_CoInitialize( $COINIT_APARTMENTTHREADED )

  ; Create callback interface and functions
  CoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerCreate( True )
  ; Forces CoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_Invoke() below to be executed

  ; Create callback interface and functions
  CoreWebView2CreateCoreWebView2ControllerCompletedHandlerCreate( True )

  ; Create callback interface and functions
  CoreWebView2ExecuteScriptCompletedHandlerCreate( True )

  ; DllCall CreateCoreWebView2EnvironmentWithOptions
  Local $hWebView2Loader = DllOpen( @AutoItX64 ? "WebView2Loader-x64.dll" : "WebView2Loader-x86.dll" )
  Local $aRet = DllCall( $hWebView2Loader, "long", "CreateCoreWebView2EnvironmentWithOptions", "wstr", "", "wstr", "", _
                         "ptr", Null, "ptr", $pCoreWebView2CreateCoreWebView2EnvironmentCompletedHandler )
  If @error Or $aRet[0] Then Return ConsoleWrite( "CreateCoreWebView2EnvironmentWithOptions ERR" & @CRLF )
  ConsoleWrite( "CreateCoreWebView2EnvironmentWithOptions OK" & @CRLF & @CRLF )

  ; Show WebView2 GUI
  GUISetState( @SW_SHOW )

  ; Loop
  While 1
    Switch GUIGetMsg()
      Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESIZED, $GUI_EVENT_RESTORE
        Local $tRect = _WinAPI_GetClientRect( $hGui )
        $oCoreWebView2Controller.put_Bounds( $tRect )

      Case $idButton
        $oCoreWebView2.ExecuteScript( "alert( 'Hello' );", $pCoreWebView2ExecuteScriptCompletedHandler )
        ; Forces CoreWebView2ExecuteScriptCompletedHandler_Invoke() below to be executed

      Case $GUI_EVENT_CLOSE
        ExitLoop
    EndSwitch
  WEnd

  ; Cleanup
  CoreWebView2CreateCoreWebView2ControllerCompletedHandlerDelete()
  CoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerDelete()
  CoreWebView2ExecuteScriptCompletedHandlerDelete()
  DllClose( $hWebView2Loader )
EndFunc

; Copied from WV2Interfaces.au3
; Executed automatically when the callback interface is created
Func CoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_Invoke( $pSelf, $long, $ptr )   ; Ret: long  Par: long;ptr*
  ConsoleWrite( "CoreWebView2CreateCoreWebView2EnvironmentCompletedHandler_Invoke" & @CRLF )

  ; Create CoreWebView2Environment object
  $oCoreWebView2Environment = ObjCreateInterface( $ptr, $sIID_ICoreWebView2Environment, $dtag_ICoreWebView2Environment )
  ConsoleWrite( "IsObj( $oCoreWebView2Environment ) = " & IsObj( $oCoreWebView2Environment ) & @CRLF & @CRLF )

  ; Set $pCoreWebView2CreateCoreWebView2ControllerCompletedHandler callback pointer for the WebView2 GUI
  $oCoreWebView2Environment.CreateCoreWebView2Controller( $hGui, $pCoreWebView2CreateCoreWebView2ControllerCompletedHandler )
  ; Forces CoreWebView2CreateCoreWebView2ControllerCompletedHandler_Invoke() below to be executed

  Return 0 ; S_OK = 0x00000000
  #forceref $pSelf, $long
EndFunc

; Copied from WV2Interfaces.au3
; Executed as a consequence of $oCoreWebView2Environment.CreateCoreWebView2Controller() above
Func CoreWebView2CreateCoreWebView2ControllerCompletedHandler_Invoke( $pSelf, $long, $ptr )   ; Ret: long  Par: long;ptr*
  ConsoleWrite( "CoreWebView2CreateCoreWebView2ControllerCompletedHandler_Invoke" & @CRLF )

  ; Create CoreWebView2Controller object
  $oCoreWebView2Controller = ObjCreateInterface( $ptr, $sIID_ICoreWebView2Controller, $dtag_ICoreWebView2Controller )
  ConsoleWrite( "IsObj( $oCoreWebView2Controller ) = " & IsObj( $oCoreWebView2Controller ) & @CRLF )
  $oCoreWebView2Controller.AddRef() ; Prevent the object from being deleted when the function ends

  ; Set bounds for the CoreWebView2 object
  Local $tRect = _WinAPI_GetClientRect( $hGui )
  $oCoreWebView2Controller.put_Bounds( $tRect )

  ; Create CoreWebView2 object
  $oCoreWebView2Controller.get_CoreWebView2( $pCoreWebView2 )
  $oCoreWebView2 = ObjCreateInterface( $pCoreWebView2, $sIID_ICoreWebView2, $dtag_ICoreWebView2 )
  ConsoleWrite( "IsObj( $oCoreWebView2 ) = " & IsObj( $oCoreWebView2 ) & @CRLF & @CRLF )

  ; Navigate to web page
  $oCoreWebView2.NavigateToString( _GetPage() )

  Return 0 ; S_OK = 0x00000000
  #forceref $pSelf, $long
EndFunc

; Copied from WV2Interfaces.au3
; Executed as a consequence of $oCoreWebView2.ExecuteScript() above
Func CoreWebView2ExecuteScriptCompletedHandler_Invoke( $pSelf, $long, $wstr ) ; Ret: long  Par: long;wstr
  ConsoleWrite( "CoreWebView2ExecuteScriptCompletedHandler_Invoke()" & @CRLF )
  ConsoleWrite( "$long = " & $long & @TAB & "$wstr = " & $wstr & @CRLF & @CRLF )
  Return 0 ; S_OK = 0x00000000
  #forceref $pSelf
EndFunc

Func _GetPage()
  Local $sPageSource = ""
  $sPageSource &= "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & @CRLF
  $sPageSource &= "<HTML><HEAD><TITLE>L E D Panel Script</TITLE>" & @CRLF
  $sPageSource &= "<META http-equiv=Content-Type content=""text/html; charset=windows-1252"">" & @CRLF
  $sPageSource &= "<STYLE type=text/css>" & @CRLF
  $sPageSource &= "" & @CRLF
  $sPageSource &= "body{" & @CRLF
  $sPageSource &= "background-color:black;" & @CRLF
  $sPageSource &= "}" & @CRLF
  $sPageSource &= "</STYLE>" & @CRLF
  $sPageSource &= "" & @CRLF
  $sPageSource &= "</HEAD>" & @CRLF
  $sPageSource &= "<BODY onload=""LEDinit()"">" & @CRLF
  $sPageSource &= "<img src=""https://www.autoitscript.com/forum/cdn/images/logo_autoit_210x72.svg"" width=""100"" height=""35"" style=""position: absolute; top: 5px; left: 200px;"">" & @CRLF
  $sPageSource &= "<SCRIPT language=JavaScript>" & @CRLF
  $sPageSource &= "" & @CRLF
  $sPageSource &= "//""L.E.D. Panel"" Script by Richard Maloney © 2002" & @CRLF
  $sPageSource &= "//For Custom effects, email Richard ( ottawo@rogers.com )" & @CRLF
  $sPageSource &= "" & @CRLF
  $sPageSource &= "//____________________CONFIGURATION AREA_____________________" & @CRLF
  $sPageSource &= "" & @CRLF
  $sPageSource &= "// THIS LED SCRIPT TAKES UP 200 pixels HORIZONTAL and 28 pixels VERTICAL -Have Fun :- )" & @CRLF
  $sPageSource &= "// YOUR MESSAGE GOES ON NEXT 4 LINES DOWN." & @CRLF
  $sPageSource &= "// ALLOWABLE CHARACTERS ARE: A-Z, Period, space, comma, numerals, question mark and 'message codes'." & @CRLF
  $sPageSource &= "// THE 4 MESSAGE CODES:" & @CRLF
  $sPageSource &= "// @=PAUSE FOR 3 SECONDS,  #=FLASH FOR 3 SECONDS, ^=SCROLL UP EFFECT, _=SUN EFFECT, $=SPLIT EFFECT" & @CRLF
  $sPageSource &= "" & @CRLF
  $sPageSource &= "//EXAMPLE: var message=""_  Dynamic^^   Drive!  #  For  the best dhtml scripts...    www.dynamic.drive.com    "";" & @CRLF
  $sPageSource &= "" & @CRLF
  $sPageSource &= "var message=""HI EVERYONE@ LARSJ HAS DONE A VERY GOOD JOB#       WEBVIEW2^^ A POWERFUL TOOL !!!@$@    A NEW SUN HAS RISEN@_     "";" & @CRLF
  $sPageSource &= "var LEDonColor='Red';        //color of the LEDs when they are on" & @CRLF
  $sPageSource &= "var LEDoffColor='#7D0605';   //color of the LEDs when they are off" & @CRLF
  $sPageSource &= "startXPos=10;               //start of horizontal position eg. startXPos=20; places the leds 20 pixels from left" & @CRLF
  $sPageSource &= "startYPos=10;              //start of vertical position" & @CRLF
  $sPageSource &= "//____________________END CONFIGURATION AREA__________________" & @CRLF
  $sPageSource &= "" & @CRLF
  $sPageSource &= "var IE=( document.all ) ? true:false; var NS=( document.layers ) ? true:false; var W3C=( ( document.getElementById ) && ( !IE ) ) ? true:false;" & @CRLF
  $sPageSource &= "var d=document; if ( window.offscreenBuffering ) window.offscreenBuffering = true;" & @CRLF
  $sPageSource &= "function getCSS( id ) {" & @CRLF
  $sPageSource &= "   if ( IE )      return d.all[id]           //IE" & @CRLF
  $sPageSource &= "   else if ( NS ) return d.layers[id]        //NS4" & @CRLF
  $sPageSource &= "   else         return d.getElementById( id )//W3C" & @CRLF
  $sPageSource &= "}" & @CRLF
  $sPageSource &= "var alphabet=new Array( 44 );" & @CRLF
  $sPageSource &= "alphabet[0]=new Array( ""0111111"",""1001000"",""1001000"",""1001000"",""0111111"" );    alphabet[1]=new Array( ""1111111"",""1001001"",""1001001"",""1001001"",""0110110"" );//B" & @CRLF
  $sPageSource &= "alphabet[2]=new Array( ""0111110"",""1000001"",""1000001"",""1000001"",""0100010"" );    alphabet[3]=new Array( ""1111111"",""1000001"",""1000001"",""1000001"",""0111110"" );//D" & @CRLF
  $sPageSource &= "alphabet[4]=new Array( ""1111111"",""1001001"",""1001001"",""1001001"" );                alphabet[5]=new Array( ""1111111"",""1001000"",""1001000"",""1001000"" );//F" & @CRLF
  $sPageSource &= "alphabet[6]=new Array( ""0111110"",""1000001"",""1000001"",""1001001"",""0101110"" );    alphabet[7]=new Array( ""1111111"",""0001000"",""0001000"",""0001000"",""1111111"" );//H" & @CRLF
  $sPageSource &= "alphabet[8]=new Array( ""1000001"",""1111111"",""1000001"" );                        alphabet[9]=new Array( ""0000110"",""0000001"",""0000001"",""0000001"",""1111110"" );//J" & @CRLF
  $sPageSource &= "alphabet[10]=new Array( ""1111111"",""0001000"",""0010100"",""0100010"",""1000001"" );   alphabet[11]=new Array( ""1111111"",""0000001"",""0000001"",""0000001"" );//L" & @CRLF
  $sPageSource &= "alphabet[12]=new Array( ""1111111"",""0010000"",""0001000"",""0010000"",""1111111"" );   alphabet[13]=new Array( ""1111111"",""0010000"",""0001000"",""0000100"",""1111111"" );//N" & @CRLF
  $sPageSource &= "alphabet[14]=new Array( ""0111110"",""1000001"",""1000001"",""1000001"",""0111110"" );   alphabet[15]=new Array( ""1111111"",""1001000"",""1001000"",""1001000"",""0110000"" );//P" & @CRLF
  $sPageSource &= "alphabet[16]=new Array( ""0111110"",""1000001"",""1000001"",""1000011"",""0111111"" );   alphabet[17]=new Array( ""1111111"",""1001000"",""1001100"",""1001010"",""0110001"" );//R" & @CRLF
  $sPageSource &= "alphabet[18]=new Array( ""0110010"",""1001001"",""1001001"",""1001001"",""0100110"" );   alphabet[19]=new Array( ""1000000"",""1000000"",""1111111"",""1000000"",""1000000"" );//T" & @CRLF
  $sPageSource &= "alphabet[20]=new Array( ""1111110"",""0000001"",""0000001"",""0000001"",""1111110"" );   alphabet[21]=new Array( ""1110000"",""0001100"",""0000011"",""0001100"",""1110000"" );//V" & @CRLF
  $sPageSource &= "alphabet[22]=new Array( ""1111110"",""0000001"",""0000010"",""0001100"",""0000010"",""0000001"",""1111110"" ); alphabet[23]=new Array( ""1100011"",""0010100"",""0001000"",""0010100"",""1100011"" );//X" & @CRLF
  $sPageSource &= "alphabet[24]=new Array( ""1100000"",""0010000"",""0001111"",""0010000"",""1100000"" );   alphabet[25]=new Array( ""1000011"",""1000101"",""1001001"",""1010001"",""1100001"" );//Z" & @CRLF
  $sPageSource &= "alphabet[26]=new Array( ""0000000"",""0000000"",""0000000"",""0000000"" );           alphabet[27]=new Array( ""0000000"",""0000001"",""0000000"",""0000000"",""0000000"" );//PERIOD" & @CRLF
  $sPageSource &= "alphabet[28]=new Array( ""0000000"",""0000000"",""1111101"",""0000000"",""0000000"" );//!" & @CRLF
  $sPageSource &= "alphabet[29]=new Array( ""0100001"",""1111111"",""0000001"" );                       alphabet[30]=new Array( ""0100011"",""1000101"",""1001001"",""1001001"",""0110001"" );//2" & @CRLF
  $sPageSource &= "alphabet[31]=new Array( ""0100010"",""1001001"",""1001001"",""1001001"",""0110110"" );   alphabet[32]=new Array( ""0001000"",""0011000"",""0101000"",""1111111"",""0001000"" );//4" & @CRLF
  $sPageSource &= "alphabet[33]=new Array( ""1111001"",""1001001"",""1001001"",""1001001"",""1000110"" );   alphabet[34]=new Array( ""0111110"",""1001001"",""1001001"",""1001001"",""0100110"" );//6" & @CRLF
  $sPageSource &= "alphabet[35]=new Array( ""1000011"",""1000100"",""1001000"",""1110000"" );           alphabet[36]=new Array( ""0110110"",""1001001"",""1001001"",""1001001"",""0110110"" );//8" & @CRLF
  $sPageSource &= "alphabet[37]=new Array( ""0110010"",""1001001"",""1001001"",""1001001"",""0111110"" );   alphabet[38]=new Array( ""0000001"",""0000010"",""0000000"" );//COMMA" & @CRLF
  $sPageSource &= "alphabet[39]=new Array( ""XXXXXXX"" );//PAUSE ( @ )" & @CRLF
  $sPageSource &= "alphabet[40]=new Array( ""YYYYYYY"" );//FLASH ( # )" & @CRLF
  $sPageSource &= "alphabet[41]=new Array( ""DDDDDDD"" );//SCROLL UP EFFECT ( ^ )" & @CRLF
  $sPageSource &= "alphabet[42]=new Array( ""SSSSSSS"" );//SUN EFFECT ( _ )" & @CRLF
  $sPageSource &= "alphabet[43]=new Array( ""0100000"",""1000000"",""1001101"",""1001000"",""0110000"" );//?" & @CRLF
  $sPageSource &= "alphabet[44]=new Array( ""QQQQQQQ"" );//SPLIT EFFECT ( $ )" & @CRLF
  $sPageSource &= "" & @CRLF
  $sPageSource &= "message=message.toUpperCase();                 //make message uppercase" & @CRLF
  $sPageSource &= "var messageArray=new Array();                  //make messageArray-an array of the letters in the message" & @CRLF
  $sPageSource &= "var columnCount=0;                                 //variable to count columns in messageArray.length" & @CRLF
  $sPageSource &= "for ( i=0; i<message.length; i++ ){              //iterate through the characters in the message" & @CRLF
  $sPageSource &= "   letterNum=message.charCodeAt( i );            //assign proper letter code ( alphabet array )" & @CRLF
  $sPageSource &= "   if ( ( letterNum>=65 ) && ( letterNum<=90 ) ) temp=letterNum-65; //letters" & @CRLF
  $sPageSource &= "   else if ( letterNum==46 ) temp=27;            //." & @CRLF
  $sPageSource &= "   else if ( letterNum==32 ) temp=26;            //space" & @CRLF
  $sPageSource &= "   else if ( letterNum==33 ) temp=28;            //!" & @CRLF
  $sPageSource &= "   else if ( ( letterNum>=49 ) && ( letterNum<=57 ) ) temp=letterNum-20; //[1-9]" & @CRLF
  $sPageSource &= "   else if ( letterNum==48 ) temp=14;            //zero" & @CRLF
  $sPageSource &= "   else if ( letterNum==63 ) temp=43;            //?" & @CRLF
  $sPageSource &= "   else if ( letterNum==44 ) temp=38;            //," & @CRLF
  $sPageSource &= "   else if ( letterNum==64 ) temp=39;            //pause" & @CRLF
  $sPageSource &= "   else if ( letterNum==35 ) temp=40;            //flash effect" & @CRLF
  $sPageSource &= "   else if ( letterNum==94 ) temp=41;            //scroll up effect" & @CRLF
  $sPageSource &= "   else if ( letterNum==95 ) temp=42;            //sunrise effect" & @CRLF
  $sPageSource &= "   else if ( letterNum==36 ) temp=44;            //split effect" & @CRLF
  $sPageSource &= "   else continue;" & @CRLF
  $sPageSource &= "   for ( ii=0; ii<alphabet[temp].length;ii++ ){ messageArray[columnCount]=alphabet[temp][ii];columnCount++;}" & @CRLF
  $sPageSource &= "   if ( ( temp!=39 ) && ( temp!=40 ) && ( temp!=41 ) ) {messageArray[columnCount]=""0000000"";columnCount++;}" & @CRLF
  $sPageSource &= "}" & @CRLF
  $sPageSource &= "//make 'led screen' with block 0-49 on row 1, block 50-99 on row 2, block 100-149 on row 3, etc.." & @CRLF
  $sPageSource &= "var b='';" & @CRLF
  $sPageSource &= "for ( var i=0; i<350; i++ ){//columns 50 columns x 7 rows" & @CRLF
  $sPageSource &= "   rowPos=0+3*( i>49 )+3*( i>99 )+3*( i>149 )+3*( i>199 )+3*( i>249 )+3*( i>299 );" & @CRLF
  $sPageSource &= "   colPos=0+150*( i>49 )+150*( i>99 )+150*( i>149 )+150*( i>199 )+150*( i>249 )+150*( i>299 );" & @CRLF
  $sPageSource &= "   b+= ( NS ) ? '<LAYER NAME=""block' + i + '"" LEFT=""' + ( startXPos+i*3-colPos ) + '"" TOP=""' + ( startYPos+rowPos ) + '"" VISIBILITY=""show"" WIDTH=""2"" HEIGHT=""2"" BGCOLOR=""' + LEDoffColor + '""></LAYER>' : '<div id=""block' + i + '"" style=""position:absolute; left:' + ( startXPos+i*3-colPos ) + 'px; top:' + ( startYPos+rowPos ) + 'px; background-color:' + LEDoffColor +'; height: 2px; width: 2px;font-size:2px;""></div>';" & @CRLF
  $sPageSource &= "}" & @CRLF
  $sPageSource &= "document.write( b );" & @CRLF
  $sPageSource &= "var columnCounter=0;   //keep track of postion of messageArray" & @CRLF
  $sPageSource &= "var bb=new Array();        //store particular LED's dom element here" & @CRLF
  $sPageSource &= "   if ( NS ) { for ( var i=0; i<350; i++ ) { bb[i]=getCSS( ""block""+i )}}" & @CRLF
  $sPageSource &= "   else {for ( var i=0; i<350; i++ ){ bb[i]=getCSS( ""block""+i ).style;}}" & @CRLF
  $sPageSource &= "var isOn=new Array();for ( var i=0; i<350; i++ ){ isOn[i]=0;}    //keep track on on/off status of particular LED" & @CRLF
  $sPageSource &= "onArray=new Array(); var onCount=0; //array size counter" & @CRLF
  $sPageSource &= "function scroll(){" & @CRLF
  $sPageSource &= "   onCount=0;" & @CRLF
  $sPageSource &= "   if ( NS ) { for ( var i=0; i<301; i+=50 ){ if ( isOn[i]==1 ) { bb[i].bgColor=LEDoffColor; isOn[i]=0;} for ( var ii=1; ii<50; ii+=7 ){" & @CRLF
  $sPageSource &= "               temp=i+ii;temp1=temp+1;temp2=temp+2;temp3=temp+3;temp4=temp+4;temp5=temp+5;temp6=temp+6;" & @CRLF
  $sPageSource &= "               if ( isOn[temp]==1 ) {bb[temp].bgColor=LEDoffColor;  isOn[temp]=0; bb[temp-1].bgColor=LEDonColor; isOn[temp-1]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp1]==1 ) {bb[temp1].bgColor=LEDoffColor;  isOn[temp1]=0; bb[temp].bgColor=LEDonColor; isOn[temp]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp2]==1 ) {bb[temp2].bgColor=LEDoffColor;  isOn[temp2]=0; bb[temp+1].bgColor=LEDonColor; isOn[temp+1]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp3]==1 ) {bb[temp3].bgColor=LEDoffColor;  isOn[temp3]=0; bb[temp2].bgColor=LEDonColor; isOn[temp2]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp4]==1 ) {bb[temp4].bgColor=LEDoffColor;  isOn[temp4]=0; bb[temp3].bgColor=LEDonColor; isOn[temp3]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp5]==1 ) {bb[temp5].bgColor=LEDoffColor;  isOn[temp5]=0; bb[temp4].bgColor=LEDonColor; isOn[temp4]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp6]==1 ) {bb[temp6].bgColor=LEDoffColor;  isOn[temp6]=0; bb[temp5].bgColor=LEDonColor; isOn[temp5]=1;}" & @CRLF
  $sPageSource &= "   }}}" & @CRLF
  $sPageSource &= "   else { for ( var i=0; i<301; i+=50 ){ if ( isOn[i]==1 ) { bb[i].backgroundColor=LEDoffColor; isOn[i]=0;} for ( var ii=1; ii<50; ii+=7 ){" & @CRLF
  $sPageSource &= "               temp=i+ii;temp1=temp+1;temp2=temp+2;temp3=temp+3;temp4=temp+4;temp5=temp+5;temp6=temp+6;" & @CRLF
  $sPageSource &= "               if ( isOn[temp]==1 ) {bb[temp].backgroundColor=LEDoffColor;  isOn[temp]=0; bb[temp-1].backgroundColor=LEDonColor; isOn[temp-1]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp1]==1 ) {bb[temp1].backgroundColor=LEDoffColor;  isOn[temp1]=0; bb[temp].backgroundColor=LEDonColor; isOn[temp]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp2]==1 ) {bb[temp2].backgroundColor=LEDoffColor;  isOn[temp2]=0; bb[temp+1].backgroundColor=LEDonColor; isOn[temp+1]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp3]==1 ) {bb[temp3].backgroundColor=LEDoffColor;  isOn[temp3]=0; bb[temp2].backgroundColor=LEDonColor; isOn[temp2]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp4]==1 ) {bb[temp4].backgroundColor=LEDoffColor;  isOn[temp4]=0; bb[temp3].backgroundColor=LEDonColor; isOn[temp3]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp5]==1 ) {bb[temp5].backgroundColor=LEDoffColor;  isOn[temp5]=0; bb[temp4].backgroundColor=LEDonColor; isOn[temp4]=1;}" & @CRLF
  $sPageSource &= "               if ( isOn[temp6]==1 ) {bb[temp6].backgroundColor=LEDoffColor;  isOn[temp6]=0; bb[temp5].backgroundColor=LEDonColor; isOn[temp5]=1;}" & @CRLF
  $sPageSource &= "   }}}" & @CRLF
  $sPageSource &= "   temp=messageArray[columnCounter]; flag=temp.charAt( 0 );//GET NEW COLUMN" & @CRLF
  $sPageSource &= "   if ( temp.charAt( 1 )==""1"" ) {isOn[99]=1;} if ( temp.charAt( 2 )==""1"" ) {isOn[149]=1} if ( temp.charAt( 3 )==""1"" ) {isOn[199]=1}" & @CRLF
  $sPageSource &= "   if ( temp.charAt( 4 )==""1"" ) {isOn[249]=1} if ( temp.charAt( 5 )==""1"" ) {isOn[299]=1} if ( temp.charAt( 6 )==""1"" ) {isOn[349]=1}" & @CRLF
  $sPageSource &= "   if ( flag==""0"" ) {} else if ( flag==""1"" ) {isOn[49]=1;} else if ( flag==""X"" ) {pauseScroll();} else if ( flag==""Y"" ) {flashScroll();}" & @CRLF
  $sPageSource &= "   else if ( flag==""D"" ) {dropEffect();} else if ( flag==""S"" ) {sunRiseEffect();} else if ( flag==""Q"" ) {splitEffect();}" & @CRLF
  $sPageSource &= "   columnCounter++; if( columnCounter==columnCount ) columnCounter=0;" & @CRLF
  $sPageSource &= "}" & @CRLF
  $sPageSource &= "//______________pause effect________________" & @CRLF
  $sPageSource &= "function pauseScroll(){ clearInterval( loop ); setTimeout( ""LEDinit()"",3000 );}" & @CRLF
  $sPageSource &= "//______________onArray Section_____________" & @CRLF
  $sPageSource &= "onArray=new Array(); var onCount=0; //array size counter" & @CRLF
  $sPageSource &= "function makeOnArray(){ clearInterval( loop ); onCount=0;    for ( var i=0; i<700; i++ ){if ( isOn[i]==1 ) {onArray[onCount]=i; onCount++;};}//make onArray of 'on' LEDS" & @CRLF
  $sPageSource &= "}//_________________________________" & @CRLF
  $sPageSource &= "//_______________flash effect_______________" & @CRLF
  $sPageSource &= "var flashCount=0;" & @CRLF
  $sPageSource &= "function flashScroll(){    makeOnArray(); flashCount=0; if ( NS ) {setTimeout( ""flashItNS()"",250 );} else {setTimeout( ""flashIt()"",250 );}}" & @CRLF
  $sPageSource &= "function flashItNS(){ flashCount++;" & @CRLF
  $sPageSource &= "   if ( flashCount<14 ) {" & @CRLF
  $sPageSource &= "       if ( flashCount % 2 == 0 ){ for ( var i=0; i<onCount; i++ ){ isOn[onArray[i]]=0;bb[onArray[i]].bgColor=LEDoffColor;}}" & @CRLF
  $sPageSource &= "       else {for ( var i=0; i<onCount; i++ ){isOn[onArray[i]]=1;bb[onArray[i]].bgColor=LEDonColor;}}" & @CRLF
  $sPageSource &= "       setTimeout( ""flashItNS()"",250 );" & @CRLF
  $sPageSource &= "   }" & @CRLF
  $sPageSource &= "   else {flashCount=0; setTimeout( ""LEDinit()"",250 );}" & @CRLF
  $sPageSource &= "}" & @CRLF
  $sPageSource &= "function flashIt(){ flashCount++;" & @CRLF
  $sPageSource &= "   if ( flashCount<14 ) {" & @CRLF
  $sPageSource &= "       if ( flashCount % 2 == 0 ){ for ( var i=0; i<onCount; i++ ){ isOn[onArray[i]]=0;bb[onArray[i]].backgroundColor=LEDoffColor;}}" & @CRLF
  $sPageSource &= "       else {for ( var i=0; i<onCount; i++ ){isOn[onArray[i]]=1;bb[onArray[i]].backgroundColor=LEDonColor;}}" & @CRLF
  $sPageSource &= "       setTimeout( ""flashIt()"",250 );" & @CRLF
  $sPageSource &= "   }" & @CRLF
  $sPageSource &= "   else {flashCount=0; setTimeout( ""LEDinit()"",250 );}" & @CRLF
  $sPageSource &= "}//_________________________________" & @CRLF
  $sPageSource &= "//____________scroll up effect______________" & @CRLF
  $sPageSource &= "dropArray=new Array();" & @CRLF
  $sPageSource &= "function dropEffect(){makeOnArray(); for ( var i=0; i<onCount; i++ ){ dropArray[i]=onArray[i]; } if ( NS ) {dropItNS();} else {dropIt();}}" & @CRLF
  $sPageSource &= "var dropCount=0;" & @CRLF
  $sPageSource &= "function dropItNS(){" & @CRLF
  $sPageSource &= "   if ( dropCount<7 ){for ( var i=0; i<onCount; i++ ){ bb[dropArray[i]].bgColor=LEDoffColor; }" & @CRLF
  $sPageSource &= "       for ( var i=0; i<onCount; i++ ){ temp=dropArray[i]; temp-=50;if ( temp<0 ) temp+=350;bb[temp].bgColor=LEDonColor; dropArray[i]=temp;}" & @CRLF
  $sPageSource &= "       dropCount++; setTimeout( ""dropItNS()"",100 );" & @CRLF
  $sPageSource &= "   } else {dropCount=0;setTimeout( ""LEDinit()"",100 );}" & @CRLF
  $sPageSource &= "}//_________________________________" & @CRLF
  $sPageSource &= "function dropIt(){" & @CRLF
  $sPageSource &= "   if ( dropCount<7 ){ for ( var i=0; i<onCount; i++ ){ bb[dropArray[i]].backgroundColor=LEDoffColor; }" & @CRLF
  $sPageSource &= "       for ( var i=0; i<onCount; i++ ){ temp=dropArray[i]; temp-=50; if ( temp<0 ) temp+=350; bb[temp].backgroundColor=LEDonColor; dropArray[i]=temp;}" & @CRLF
  $sPageSource &= "       dropCount++; setTimeout( ""dropIt()"",100 );" & @CRLF
  $sPageSource &= "   } else {dropCount=0;setTimeout( ""LEDinit()"",100 );}" & @CRLF
  $sPageSource &= "}//_________________________________" & @CRLF
  $sPageSource &= "//____________sunrise effect________________" & @CRLF
  $sPageSource &= "sunRiseCounter=0;sunRiseArray=new Array();" & @CRLF
  $sPageSource &= "sunRiseArray[0]=new Array( 50,101,102,103,154,155,156,207,208,259,260,261,212,163,164,115,116,117,168,169,170,221,222,223,274,275,276,227,228,179,180,131,132,83,134,135,186,187,238,239,240,241,292,293,344,295,296,247,198 );//Hills" & @CRLF
  $sPageSource &= "sunRiseArray[1]=new Array( 224,225,226 ); sunRiseArray[2]=new Array( 174,175,176,177 ); sunRiseArray[3]=new Array( 173,124,125,126,127,128,178 ); sunRiseArray[4]=new Array( 172,123,74,75,76,77,129 ); sunRiseArray[5]=new Array( 171,122,73,24,25,26,27,78,79,130 );" & @CRLF
  $sPageSource &= "function sunRiseEffect() { makeOnArray(); for ( var i=0; i<onCount; i++ ){ isOn[onArray[i]]=0; if ( !NS ) {bb[onArray[i]].backgroundColor=LEDoffColor;}    else {bb[onArray[i]].bgColor=LEDoffColor;}}" & @CRLF
  $sPageSource &= "   setTimeout( ""riseEffectUp()"",1000 );}" & @CRLF
  $sPageSource &= "function riseEffectUp() {" & @CRLF
  $sPageSource &= "   if ( !NS ) { for ( var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++ ) {isOn[sunRiseArray[sunRiseCounter][ii]]=1;bb[sunRiseArray[sunRiseCounter][ii]].backgroundColor=LEDonColor;}}" & @CRLF
  $sPageSource &= "   else {for ( var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++ ) {isOn[sunRiseArray[sunRiseCounter][ii]]=1;bb[sunRiseArray[sunRiseCounter][ii]].bgColor=LEDonColor;}}" & @CRLF
  $sPageSource &= "   sunRiseCounter++; if ( sunRiseCounter>5 ) {sunRiseCounter=5;setTimeout( ""riseEffectDown()"",2000 );}   else {setTimeout( ""riseEffectUp()"",250 );}}" & @CRLF
  $sPageSource &= "function riseEffectDown() {" & @CRLF
  $sPageSource &= "   if ( !NS ) {for ( var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++ ) {isOn[sunRiseArray[sunRiseCounter][ii]]=0;bb[sunRiseArray[sunRiseCounter][ii]].backgroundColor=LEDoffColor;}}" & @CRLF
  $sPageSource &= "   else {for ( var ii=0; ii<sunRiseArray[sunRiseCounter].length; ii++ ) {isOn[sunRiseArray[sunRiseCounter][ii]]=0;bb[sunRiseArray[sunRiseCounter][ii]].bgColor=LEDoffColor;}}" & @CRLF
  $sPageSource &= "   sunRiseCounter--; if ( sunRiseCounter<1 ) {sunRiseCounter=0;setTimeout( ""LEDinit()"",1500 );}" & @CRLF
  $sPageSource &= "   else {setTimeout( ""riseEffectDown()"",250 );}" & @CRLF
  $sPageSource &= "}//____________________________________" & @CRLF
  $sPageSource &= "//____________split scroll effect___________" & @CRLF
  $sPageSource &= "var splitCount=0;" & @CRLF
  $sPageSource &= "function splitEffect() { makeOnArray(); for ( var i=0; i<onCount; i++ ) { dropArray[i]=onArray[i]; }" & @CRLF
  $sPageSource &= "   if ( NS ) {setTimeout( ""splitNS()"",55 );} else if ( IE ) {setTimeout( ""splitIt()"",55 );} else {setTimeout( ""splitIt()"",100 );}" & @CRLF
  $sPageSource &= "}" & @CRLF
  $sPageSource &= "function splitIt(){ for ( i=0;i<onCount;i++ ){ temp=dropArray[i];" & @CRLF
  $sPageSource &= "   if ( temp<150 ) { if ( temp==100 ) {bb[temp].backgroundColor=LEDoffColor; temp=149; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==50 ) {bb[temp].backgroundColor=LEDoffColor; temp=99; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==0 ) {bb[temp].backgroundColor=LEDoffColor; temp=49; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else {bb[temp].backgroundColor=LEDoffColor; bb[temp-1].backgroundColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           dropArray[i]=temp-1; }" & @CRLF
  $sPageSource &= "       else { if ( temp==199 ) {bb[temp].backgroundColor=LEDoffColor; temp=200; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==349 ) {bb[temp].backgroundColor=LEDoffColor; temp=300; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==299 ) {bb[temp].backgroundColor=LEDoffColor; temp=250; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==249 ) {bb[temp].backgroundColor=LEDoffColor; temp=200; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else {bb[temp].backgroundColor=LEDoffColor; bb[temp+1].backgroundColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           dropArray[i]=temp+1; }" & @CRLF
  $sPageSource &= "   } splitCount++; if ( splitCount<49 ) {if ( IE ) {setTimeout( ""splitIt()"",55 );} else {setTimeout( ""splitIt()"",100 );} } else {splitCount=0; LEDinit();}" & @CRLF
  $sPageSource &= "}" & @CRLF
  $sPageSource &= "function splitNS(){" & @CRLF
  $sPageSource &= "   for ( i=0;i<onCount;i++ ){ temp=dropArray[i];" & @CRLF
  $sPageSource &= "       if ( temp<150 ) { if ( temp==100 ) {bb[temp].bgColor=LEDoffColor; temp=149; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==50 ) {bb[temp].bgColor=LEDoffColor; temp=99; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==0 ) {bb[temp].bgColor=LEDoffColor; temp=49; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else {bb[temp].bgColor=LEDoffColor; bb[temp-1].bgColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           dropArray[i]=temp-1; }" & @CRLF
  $sPageSource &= "       else { if ( temp==199 ) {bb[temp].bgColor=LEDoffColor; temp=200; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==349 ) {bb[temp].bgColor=LEDoffColor; temp=300; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==299 ) {bb[temp].bgColor=LEDoffColor; temp=250; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else if ( temp==249 ) {bb[temp].bgColor=LEDoffColor; temp=200; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           else {bb[temp].bgColor=LEDoffColor; bb[temp+1].bgColor=LEDonColor;}" & @CRLF
  $sPageSource &= "           dropArray[i]=temp+1; }" & @CRLF
  $sPageSource &= "   } splitCount++; if ( splitCount<49 ) {setTimeout( ""splitNS()"",55 );} else {splitCount=0; LEDinit();}" & @CRLF
  $sPageSource &= "}//___________________________________" & @CRLF
  $sPageSource &= "function LEDinit(){if ( NS ) {loop=setInterval( ""scroll()"",55 );} else if ( IE ){loop=setInterval( ""scroll()"",55 );} else {loop=setInterval( ""scroll()"",100 );}}" & @CRLF
  $sPageSource &= "</SCRIPT>" & @CRLF
  $sPageSource &= "</BODY></HTML>" & @CRLF
  Return $sPageSource
EndFunc

The code is translated to AutoIt from the C++ code in ICoreWebView2.ExecuteScript() and from this example by Chimp.

Compared to the original script by Chimp the ICoreWebView2ExecuteScriptCompletedHandler callback interface is added to the code.

WebView2-4.au3 is included in the 7z-file at bottom of this post.

 

On 2/10/2021 at 4:46 PM, Chimp said:

So WV2Interfaces.au3 is still under construction

If the code here is to be a replacement for IE.au3, then I think we'll have to translate all C/C++ code in WebView2.h to AutoIt code in WV2Interfaces.au3.

 

I'll create a new post to document the implementation of callback interfaces.

Edited by LarsJ
Headline updated
Link to comment
Share on other sites

Great! I'm starting to like this stuff a lot. Thanks @LarsJ

A quick and dirty little example of how this ExecuteScript method is very powerful, for example to manipulate the web page content on the fly:

replace the simple command "alert ('Hello');" from within the ExecuteScript in the listing

$oCoreWebView2.ExecuteScript( "alert( 'Hello' );", $pCoreWebView2ExecuteScriptCompletedHandler )

with this other

$oCoreWebView2.ExecuteScript("document.getElementsByTagName(""img"").item(0).insertAdjacentHTML('beforebegin', '<iframe width=""210"" height=""173"" style=""position: absolute; top: 50px; left: 10px;"" src=""https://www.youtube.com/embed/tgbNymZ7vqY?autoplay=1""></iframe>');", $pCoreWebView2ExecuteScriptCompletedHandler )

and we will add a YouTube movie on the page. (do not press the button multiple times or more overlapping videos will be added)

see you later...

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
Share on other sites

I'm testing Getting started example step 6: Communication but it doesn't work. How should this JavaScript code that works in C++

webviewWindow->AddScriptToExecuteOnDocumentCreated(
  L"window.chrome.webview.addEventListener(\'message\', event => alert(event.data));" \
  L"window.chrome.webview.postMessage(window.document.URL);",
  nullptr);

be expressed in AutoIt?

Link to comment
Share on other sites

? about the syntax should be like this:

$oCoreWebView2.AddScriptToExecuteOnDocumentCreated("window.chrome.webview.addEventListener('message', event => alert(event.data)); window.chrome.webview.postMessage(window.document.URL);", Null)

sorry, edit after a check:
don't ask me why, but I've seen that it works if you remove the ".chrome.webview" part, that is, like this:

$oCoreWebView2.AddScriptToExecuteOnDocumentCreated("window.addEventListener('message', event => alert(event.data)); window.postMessage(window.document.URL);", Null)

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
Share on other sites

Now the JavaScript code works. But the Communication example still doesn't work. The Invoke method of the CoreWebView2WebMessageReceivedEventHandler callback interface isn't called and a COM error is generated when the script exits. For the time being, let's leave this problem alone.

The Getting started examples except the Communication example can be found in the 7z-file at bottom of this post.

Now we've more or less been through all the Getting started examples. How do we get on from here?

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...