Jump to content

Gianni

MVPs
  • Posts

    2,673
  • Joined

  • Last visited

  • Days Won

    38

Gianni last won the day on April 25

Gianni had the most liked content!

7 Followers

About Gianni

  • Birthday 05/02/1962

Profile Information

  • Location
    Italy

Recent Profile Visitors

4,775 profile views

Gianni's Achievements

  1. A first attempt at interaction between AutoIt and OrdoWebView2 it seems to me that some small anomalies occur (but maybe it's me who doesn't use them correctly), such as: the value of an AutoIt variable set by reading the value of a property of a browser object is not immediately available in AutoIt, but delays must be inserted before reading its value. However, I have set 3 callback functions related to the following events: "navigation completed"; "zoom change" and "asynchronous JS result". In particular, this last event should be executed only if you use the execution of a javascript script using the RunJsAsync() method. well, although I have not used that method in the AutoIt script but have only used the RunJs() method, I see that the JSAsyncResult callback function is occasionally executed anyway (?). Well, this test script uses a web page that contains a "label" where the text changes to "I'm not a robot" only when the three red cubes have been clicked. (You could use this as a sort of graphical "CAPTCHA"). You can rotate the cube by dragging with the mouse so that any red cubes that are "on the back" come to the forefront so that you can click them. The interaction with AutoIt consists of reading the value of that JS field to check when it changes to "I'm not a robot" and acting accordingly in AutoIt. It seems to work, but I think I still need to dig deeper into this functionality. The zoom change event is executed when the browser zoom is changed. To change the zoom you can hold down the "ctrl" key on the keyboard and simultaneously rotate the mouse wheel up or down. To reset the zoom to 100% press "ctrl" and zero on the numpad. Here is the "experiment". #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "OrdoWebView2.au3" Global $bReloaded = False ; to be used in NavigationCompleted callback function _TestOrdoWebView() Func _TestOrdoWebView() Local $hMain_GUI = GUICreate("Main GUI", 500, 520, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) Local $hButton1 = GUICtrlCreateButton("I give up", 10, 495, 480, 20) GUISetState(@SW_SHOW, $hMain_GUI) Local $aEBWebView1 = webview2_GUI_Create(480, 480, 10, 10, $hMain_GUI, "_OrdoWebView_") ; 6° parameter: Events Callback funcion name prefix ; a javascript function to be injected in Document for a later use from AutoIt via .RunJs or .RunJsAsync $aEBWebView1[0].AddScriptToExecuteOnDocumentCreated("function getQSValue(qsExpr){return document.getElementById((qsExpr)).innerHTML}") ; Load web page $aEBWebView1[0].Navigate("https://shzlw.github.io/design/I-am-not-a-robot.html") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hButton1 MsgBox(0, 'AutoIt', "Test failed. Goodbye") ExitLoop EndSwitch If $aEBWebView1[0].RunJs("getQSValue", "label") = "I'm not a robot" Then MsgBox(0, 'AutoIt', "Great! You are not a robot. Welcome human!") $aEBWebView1[0].Reload Do ConsoleWrite('.') Until $bReloaded $bReloaded = False ; if there is not this MsgBox to produce a long delay sometimes the reload is executed twice MsgBox(0, 'AutoIt', "Play again") EndIf WEnd _SysFreeString($pProgID) GUIDelete($aEBWebView1[1]) GUIDelete($hMain_GUI) EndFunc ;==>_TestOrdoWebView ; --- CallBack functions --- Volatile Func _OrdoWebView_NavigationCompleted($IsSuccess, $WebErrorStatus) ConsoleWrite("_OrdoWebView_NavigationCompleted" & @CRLF) $bReloaded = True EndFunc ;==>_OrdoWebView_NavigationCompleted Volatile Func _OrdoWebView_ZoomChanged($iValue) ConsoleWrite("New Zoom Value is : " & $iValue & @CRLF) TrayTip("Zoom changed", "New zoom value is: " & $iValue, 3, 17) EndFunc ;==>_OrdoWebView_ZoomChanged Volatile Func _OrdoWebView_JSAsyncResult($vResult, $vToken, $sErrString) ConsoleWrite("Javascript result: " & $vResult & @CRLF & $vToken & @CRLF & $sErrString & @CRLF) EndFunc ;==>_OrdoWebView_JSAsyncResult
  2. Indeed, no need to register anything other than OrdoWebView2.ocx You just need a folder containing the files as shown in the figure below \MYFOLDER | OrdoWebView2.ocx | OrdoWebView2.au3 | OrdoWebView2_Demo.au3 | \---OrdoRC6 cairo_sqlite.dll DirectCOM.dll RC6.dll RC6Widgets.dll RegisterRC6inPlace.vbs RegisterRC6WidgetsInPlace.vbs WebView2Loader.dll _Library-Licenses.txt _Version-History.txt (You can find the necessary files in the 7z file in @Danyfirex's post as indicated in first post above) As @Ninedid, I also did the following: created a folder containing necessary files as above opened a DOS prompt with administrative rights; placed the current directory where the OrdoWebView2.ocx file is located I typed the following command: regsvr32 .\OrdoWebView2.ocx I received the popup message with the message "DllRegisterServer in .\OrdoWebView2.ocx succeeded" That's it, then running the OrdoWebView2_Demo.au3 file everything worked fine thanks all for the feedbacks
  3. You can start the OrdoWebView2 control in "incognito" mode by setting the .IsPrivateNavigation parameter to True in the InitEx method, as described in the OrdoWebView2.ocx control help (https://freeware.ordoconcept.net/Help/OrdoWebView2/topics/InitEx.htm). This way the user data folder should be automatically and silently created in a temporary location and is not stored permanently, but only exists during the session and is deleted when it ends. P.S. In order not to hijack this topic too much, I created a new Topic specifically related to the OrdoWebView2.ocx control
  4. Although I think the best way to use WebView2 in AutoIt would be to complete and use the work started by @LarsJ in this other @mLipok's topic, now it is possible to use WebView2 in AutoIt in a much simpler way. This is possible thanks to this ocx control and thanks to @Danyfirex for his decisive contribution. Now we can easily start embedding one or more WebView2 controls in our GUI in AutoIt. What we need is: the OrdoWebView2.ocx control and the \OrdoRC6 folder. These two are installed together with other programs (in the C:\Program Files (x86)\OrdoWebView2Control folder) by running the OrdoWebView2ActiveXControl.2.0.9.exe program downloadable from this link: https://freeware.ordoconcept.net/OrdoWebview2.php by clicking on "Download OrdoWebView2 SDK" at the bottom of the screen. Or, more simply, you can find them directly attached to this post by @Danyfirex. As explained in this post on VBForums (https://www.vbforums.com/showthread.php?899415-OrdoWebview2-ActiveX-WebView2-Browser-Control-(Replacement-of-the-MS-browser-control)&p=5651133&viewfull=1#post5651133): "On the latest versions of Windows 10 and Windows 11, only the following components are needed: OrdoWebView2.ocx OrdoRC6 folder and its contents, in the same directory as OrdoWebView2.ocx Finally, you need to register OrdoWebView2.ocx with regsvr32.exe OrdoWebView2.ocx". Also: Our AutoIt script and the OrdoWebView2.au3 must also be in the same directory along with the above. I have extracted the essential parts needed to create the WebView2 object from the DanyFirex's original example and grouped them into the OrdoWebView2.au3 UDF so that it can be easily included into a program. This is just a quick draft to get you started, but it can definitely be improved. Suggestions are welcome. Here are the basic UDF and a very basic example script: Embed 4 WebView2 controls in an AutoIt GUI More scripts to follow to test the functionality and interaction between OrdoWebView2 and AutoIt. See you later. P.S. Here is a reference link to the OrdoWebView2.ocx help (https://freeware.ordoconcept.net/Help/OrdoWebView2/) OrdoWebView2.au3 ; From the following POST By DanyFirex: ; https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/page/9/#findComment-1542694 ; ... first draft to be continue ... #include <WinAPI.au3> Global Const $gATL = DllOpen("ATL.DLL") Global Const $gOleaut32 = DllOpen("oleaut32.dll") _WinAPI_CoInitialize($COINIT_APARTMENTTHREADED) AtlAxWinInit() Global $pProgID = SysAllocString('OrdoWebView2.OrdoWebView') Func webview2_GUI_Create($w, $h, $x, $y, $hMain, _ $sEventsPrefix = '', _ ; ......................... The prefix of the functions you define to handle receiving events. The prefix is appended by the Objects event name. $sLang = "", _ ; ................................. Language defined by the 2-letter code from ISO 639. If omitted, the chosen language will be that of the user's system. $bIsPrivateNavigation = False, _ ; ............... if TRUE the browser goes into private browsing mode. Default value is False $sBrowserInstallPath = "", _ ; ................... sets the installation directory of the WebView2 fixed version. Only considered if UseEdgeFixedVersion is TRUE. $sUserDataFolder = "", _ ; ....................... defines the user's browsing data directory. If empty, use default user assignment directory. Ignored if IsPrivateNavigation is true $sAdditionalBrowserArguments = "", _ ; ........... Allows passing parameters to the Chromium WebView2 browser through command line switches. You can find a list of Chromium Command Line Switches here $iAllowSingleSignOnUsingOSPrimaryAccount = 0) ; .. Determines whether to enable single sign on with Azure Active Directory Local $hGUI_1 = GUICreate('', $w, $h, $x, $y, $WS_POPUPWINDOW) ; BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) Local $hResult = AtlAxCreateControl($pProgID, $hGUI_1) ; _SysFreeString($pProgID) Local $pIUnkown = AtlAxGetControl($hGUI_1) ; ConsoleWrite("AtlAxGetControl: " & $pIUnkown & @CRLF) _WinAPI_SetParent($hGUI_1, $hMain) ; trap this child gui within the main gu GUISetState(@SW_SHOW, $hGUI_1) Local $oOrdoWebView2 = ObjCreateInterface($pIUnkown, "{E54909AA-1705-44A9-8235-B24F74366B3F}") Local $oOrdoWebViewEvents = ObjEvent($oOrdoWebView2, $sEventsPrefix, "__OrdoWebView") ; ConsoleWrite("$oOrdoWebView2: " & IsObj($oOrdoWebView2) & @CRLF) ; ConsoleWrite($oOrdoWebView2.GetWebView2Version() & @CRLF) ; ConsoleWrite($oOrdoWebView2.GetMostRecentInstallPath() & @CRLF) #cs $oOrdoWebView2.Anchor = True $oOrdoWebView2.Search_URL = "https://search.yahoo.com/search?p=%1" $oOrdoWebView2.HomeURL = "http://www.google.com" $oOrdoWebView2.SearchEngine = 2 $oOrdoWebView2.SearchAuto = True #ce $oOrdoWebView2.UseEdgeFixedVersion = False $oOrdoWebView2.InitEx($sLang, $bIsPrivateNavigation, $sBrowserInstallPath, $sUserDataFolder, $sAdditionalBrowserArguments, $iAllowSingleSignOnUsingOSPrimaryAccount) While Not $oOrdoWebView2.IsWebViewInit() ;wait initialization otherwise Navigate will fail Sleep(100) WEnd Local $aReturn = [$oOrdoWebView2, $hGUI_1] Return $aReturn ; $oOrdoWebView2 EndFunc ;==>webview2_GUI_Create Func AtlAxCreateControl($pProgID, $HWND) Local $aCall = DllCall($gATL, "long", "AtlAxCreateControl", "ptr", $pProgID, "handle", $HWND, "ptr", 0, "ptr", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxCreateControl Func AtlAxGetControl($HWND) Local $aCall = DllCall($gATL, "long", "AtlAxGetControl", "handle", $HWND, "ptr*", 0) If @error Then Return SetError(1, 0, -1) Return $aCall[2] EndFunc ;==>AtlAxGetControl Func AtlAxWinInit() Local $aCall = DllCall($gATL, "bool", "AtlAxWinInit") If @error Then Return SetError(1, 0, -1) Return $aCall[0] EndFunc ;==>AtlAxWinInit Func _SysFreeString($pBSTR) ; Author: Prog@ndy If Not $pBSTR Then Return SetError(2, 0, 0) DllCall($gOleaut32, "none", "SysFreeString", "ptr", $pBSTR) If @error Then Return SetError(1, 0, 0) EndFunc ;==>_SysFreeString Func SysAllocString($str) ; Author: monoceres Local $aCall = DllCall($gOleaut32, "ptr", "SysAllocString", "wstr", $str) If @error Then Return SetError(1, 0, 0) Return $aCall[0] EndFunc ;==>SysAllocString OrdoWebView2_Demo.au3 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "OrdoWebView2.au3" Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") _TestOrdoWebView() Func _TestOrdoWebView() Local $hMain_GUI = GUICreate("Main GUI", 990, 810, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) GUISetState(@SW_SHOW, $hMain_GUI) Local $hAutoIt_Button_1 = GUICtrlCreateButton("test", 10, 785) ; Create 4 controls Local $aWebView1 = webview2_GUI_Create(480, 380, 10, 10, $hMain_GUI) Local $aWebView2 = webview2_GUI_Create(480, 380, 500, 10, $hMain_GUI) Local $aWebView3 = webview2_GUI_Create(480, 380, 10, 400, $hMain_GUI) Local $aWebView4 = webview2_GUI_Create(480, 380, 500, 400, $hMain_GUI) ; Navigate to web pages $aWebView1[0].Navigate("https://www.kevs3d.co.uk/dev/js1kdragons/") ; "http://www.3quarks.com/en/SegmentDisplay/" $aWebView2[0].Navigate("https://gridstackjs.com/demo/anijs.html") ; "https://retejs.org/") $aWebView3[0].Navigate("https://www.youtube.com/watch?v=ojBYW3ycVTE") $aWebView4[0].Navigate("https://freeware.ordoconcept.net/OrdoWebview2.php") ; "https://freeware.ordoconcept.net/Help/OrdoWebView2/" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $hAutoIt_Button_1 MsgBox(0, 'AutoIt', 'Hi') EndSwitch WEnd _SysFreeString($pProgID) GUIDelete($aWebView1[1]) GUIDelete($aWebView2[1]) GUIDelete($aWebView3[1]) GUIDelete($aWebView4[1]) GUIDelete($hMain_GUI) EndFunc ;==>_TestOrdoWebView ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc
  5. Hi @Danyfirex, thank you so much for this script! Now I have put in the same directory as your script the folder \OrdoRC6 and the file OrdoWebView2.ocx (I also registered OrdoWebView2.ocx with the command "regsvr32 OrdoWebView2.ocx" from an admin prompt) and everything works like a charm. Thanks again for this "Easter gift" I will play with it in the next days. You are great!
  6. Hi Ptrex, thanks for this post, by installing the material you posted I was only able to run the examples contained in it, but unfortunately OrdoWebView2.ocx continues not to work. Although the variable $oWebView2 in my script above is an object, it seems not to "contain" the reference to the Webview2 control. Probably the instantiation of WebView2 by the OCX fails ...(?) What is strange is that the example program Test.exe included in the directory \OrdoWebView2Control\ which also contains OrdoWebView2.ocx works regularly, therefore all the "dependencies" that are needed should already be present. In addition, in this post (https://www.vbforums.com/showthread.php?899415-OrdoWebview2-ActiveX-WebView2-Browser-Control-(Replacement-of-the-MS-browser-control)&p=5651133&viewfull=1#post5651133) on the site "vbforums", it is written which are the essential files for the OrdoWebView2.ocx control to work. What a pity that there are always problems in getting something to work.
  7. Thanks @ptrex ...from what you can read on the OrdoWebView2's control description page it seems that all the necessary dependencies should be installed by OrdoWebView2ControlRedistributable.exe. literally: "In the "Redistributable" folder, OrdoWebView2ControlRedistributable.exe is used to install the control and its dependencies on a client machine. Launched with the /verysilent option, this program can be integrated into the installer of your own solution." in truth at first glance I couldn't find that executable on the HD, but then I saw that it is present with a slightly different name and that is OrdoWebView2ControlRedistribuable.exe, the name ends with "...Redistribuable.exe" instead of "...Redistributable.exe", a "t" is missing in the file name. however even manually running that file doesn't seem to solve the problem...
  8. ... a little digression from the OP Browsing the internet I came across this interesting page (https://freeware.ordoconcept.net/OrdoWebview2.php) where there is an ocx through which it should be possible to use WebView2. Actually it refers to VB6, but maybe it can be adapted here too? To test it I installed OrdoWebView2 SDK (https://freeware.ordoconcept.net/download.php?file=OrdoWebView2ActiveXControl.2.0.9.exe). I then tried to use it through this simple script which is an adaptation of a similar script by @ptrex taken from this link, but I receive an error from the ocx: "Run-time error '0'"; the methods are not executed and not even the browser is incorporated into the GUI. Does anyone know how and if it is possible to make it work here? thanks. #AutoIt3Wrapper_UseX64=N #include <GUIConstantsEx.au3> ; Initialize COM error handler $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Load ActiveX module $hActiveX = DllOpen("C:\Windows\SysWOW64\OrdoWebView2.ocx") ; Object identifiers Global Const $sCLSID = "{56335193-C129-41AC-B94A-B26B9B7469CF}" ; retrieved from the registry Global Const $sIID = Default ; Create a simple GUI for our output Local $hWebView2 = GUICreate("WebView2 ocx test", 1000, 580, (@DesktopWidth - 1000) / 2, (@DesktopHeight - 580) / 2) GUISetState(@SW_SHOW) ;Show GUI ; Create Com Object ; Local $oWebView2 = ObjCreate("OrdoWebView2.OrdoWebView") ; HEXEDIT.HexEditCtrl.1") Local $oWebView2 = ObjCreate($sCLSID, $sIID, $hActiveX) If IsObj($oWebView2) Then MsgBox(64, "Object's info", _ "Name of Object is:...." & ObjName($oWebView2, 1) & @CRLF & _ "Description string is:.........." & ObjName($oWebView2, 2) & @CRLF & _ "ProgID is:......................" & ObjName($oWebView2, 3) & @CRLF & _ "File associated in Registry is:." & ObjName($oWebView2, 4) & @CRLF & _ "Module name in which runs is:..." & ObjName($oWebView2, 5) & @CRLF & _ "CLSID of object's coclass is:..." & ObjName($oWebView2, 6) & @CRLF & _ "IID of object's interface is:..." & ObjName($oWebView2, 7)) Else Exit MsgBox(16, '', "Error occurred") EndIf ; https://freeware.ordoconcept.net/Help/OrdoWebView2/ $oWebView2.Anchor = True $oWebView2.HomeURL = "https://www.google.com/" $oWebView2.SearchEngine = 'Google' $oWebView2.Init $GUIActiveX = GUICtrlCreateObj($oWebView2, 10, 10, ((@DesktopWidth - 1000) / 2) - 20, ((@DesktopHeight - 580) / 2)) - 20) ; GUICtrlSetResizing($GUIActiveX, $GUI_DOCKAUTO) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; COM Error Handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "AutoItCOM", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext) SetError(1) EndFunc ;==>MyErrFunc
  9. If you want the text scrolling to continue even when you drag the GUI or even when an MsgBox() is in action, you can use _WinAPI_SetTimer instead of AdlibRegister, as in this slightly modified version of your script. ... But if you don't care, then forget it ... #include <GUIConstants.au3> #include <WinAPISysWin.au3> $guiWidth = 300 $hGUI = GUICreate("Main GUI", $guiWidth, 70) $sString = "This is a long string that scrolls smoothly and infinitely in a short label control." ; Create a child GUI for scrolling label $iMargin = 10 $sGap = " " $iLabelWidth = $guiWidth - $iMargin * 2 $hChildGUI = GUICreate("", $iLabelWidth, 20, 10, 10, $WS_CHILD, -1, $hGUI) GUISetFont(12, 400, 0, "Arial") ; Create a label wide enough to hold a long string without truncation $idLabel = GUICtrlCreateLabel($sString, 0, 0, 2000, 20, BitOR($SS_NOPREFIX, $SS_LEFTNOWORDWRAP)) ; Get the string width $tmpLabel = GUICtrlCreateLabel($sString, 0, 0, -1, 20, BitOR($SS_NOPREFIX, $SS_LEFTNOWORDWRAP)) $iStringWidth = ControlGetPos($hChildGUI, "", $tmpLabel)[2] - 9 ; Label is wider than the string width by 9 pixels GUICtrlDelete($tmpLabel) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hChildGUI) ; Update the label data if the string width is larger than the label width If $iStringWidth > $iLabelWidth Then GUICtrlSetData($idLabel, $sString & $sGap & $sString) $iScrollPos = 0 $iMarquee = 0 $iScrollDelay = 40 ; AdlibRegister("_Marquee", $iScrollDelay) ; -- setup timer-- Local $hTimerProc = DllCallbackRegister('_Marquee', 'none', 'hwnd;uint;uint_ptr;dword') Local $iTimerID = _WinAPI_SetTimer(0, 0, $iScrollDelay, DllCallbackGetPtr($hTimerProc)) ; ---------------- EndIf MsgBox(64, "Info", "text scrolls") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; -- clean timer-- _WinAPI_KillTimer(0, $iTimerID) DllCallbackFree($hTimerProc) ; ---------------- Func _Marquee($hWnd, $iMsg, $iTimerID, $iTime) #forceref $hWnd, $iMsg, $iTimerID, $iTime $iMarquee += 1 If $iMarquee < 3000 / $iScrollDelay Then Return ; 3 seconds of halt when $sString comes to the initial position $iScrollPos -= 1 If - $iScrollPos = $iStringWidth + StringLen($sGap) * 4 Then ; Initialize the $idLabel's position $iMarquee = 0 $iScrollPos = 0 EndIf GUICtrlSetPos($idLabel, $iScrollPos, 0) EndFunc ;==>_Marquee
  10. Hi @WildByDesign Thanks for the kind words, ... glad I could help ..
  11. I shamelessly used (copied and pasted) a very nice @eukalyptus's script to underline and send you some auspicious messages ... sorry for the laziness... ; source ; https://autoit.de/thread/17855-led-laufschrift/ ; ; reference for this script (by Eukalyptus): ; https://autoit.de/thread/17855-led-laufschrift/?postID=140164#post140164 #include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GDIPlusConstants.au3> ; #include "LEDTXT.au3" ; (by Eukalyptus) already embedded here below Local $sText1 = "Hello friends! ☺ best wishes for a happy holiday and a happy new year (me)" Local $sText2 = "Let us greet together this new year that ages our friendship without aging our hearts. (Victor Hugo)" Local $sText3 = "The best time to plant a tree was 20 years ago. The second best time is now. (Chinese proverb)" Local $sText4 = "The future belongs to those who believe in the beauty of their dreams. (Eleanor Roosevelt)" Local $sText5 = "In the end, what matters is not the years of your life, but the life you put into those years. (Abraham Lincoln)" HotKeySet("{ESC}", "_Exit") _GDIPlus_Startup() $hGuiTrans = GUICreate("", @DesktopWidth, 300, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($hGuiTrans, 0xABCDEF) GUISetState() $hGui = GUICreate("", @DesktopWidth, 400, 0, 300, Default, $WS_EX_TOPMOST) ; WinSetTrans($hGui, "", 100) GUISetState() #cs parameters info: $hGui: Handle to the window $sText: The text $iX: X position of the scrolling text $iY: Y position $iW: Length $iH: Height $iType: Appearance of the LEDs 0=Round with 3D effect, 1=Square with 3D, 2=Round, 3=Square; (the last two are filled and/or outlined, depending on which colors are <>0) $iLedW = X-size of an LED $iLedH = Y-size of an LED $nLedOnCol1 = Color 1 of the ON LEDs (foreground for 3D, fill color for $iType 2 and 3) $nLedOnCol2 = Color 2 of the ON LEDs (background for 3D, color of the outline for $iType 2 and 3) $nLedOffCol1 = Color 1 of the OFF LEDs $nLedOffCol2 = Color 2 of the OFF LEDs $nBkColor = Background color $iDistW = X-distance of the LEDs $iDistH = Y-distance of the LEDs $sFont = Font $iTextSize = Font size $iTextOpt = Font options (see _GDIPlus_FontCreate ) $iTextOffY = Y offset of the font #ce $aLed1 = _LEDTXT_Create_Gdi($hGuiTrans, $sText1, 0, 0, @DesktopWidth, 50, 0, 2, 2, 0xFFFFAA00, 0xFF000000, 0xAA111122, 0xAA000000, 0, 0, 0, "Courier New", 40, 1) $aLed2 = _LEDTXT_Create_Gdi($hGuiTrans, $sText2, 0, 50, @DesktopWidth, 50, 3, 2, 2, 0, 0xFF0088FF, 0, 0xFF000000, 0, 0, 0, "Arial", 40, 1) $aLed3 = _LEDTXT_Create_Gdi($hGuiTrans, $sText3, 0, 100, @DesktopWidth, 100, 1, 4, 4, 0xFFFF0000, 0xFF000000, 0, 0, 0xFFABCDEF, 1, 1, "Times New Roman", 80, 1) $aLed4 = _LEDTXT_Create_Gdi($hGuiTrans, $sText4, 0, 200, @DesktopWidth, 100, 1, 4, 4, 0xFF00FF00, 0xFF000000, 0xFFABCDEF, 0xFFABCDEF, 0xFFABCDEF, 0, 0, "Arial", 80, 1) $aLed5 = _LEDTXT_Create_Gdi($hGui, $sText5, 0, 0, @DesktopWidth, 350, 0, 14, 14, 0xFF00FF00, 0xFF00AA00, 0x44111119, 0x4400EE00, 0x44000000, 0, 0, "Arial", 410, 1, -60) GUIRegisterMsg($WM_ERASEBKGND, "_WM_ERASEBKGND") While 1 _LEDTXT_Step($aLed1, 1) _LEDTXT_Step($aLed2, -1) _LEDTXT_Step($aLed3, 1) _LEDTXT_Step($aLed4, -1) _LEDTXT_Step($aLed5, 1) _WinAPI_RedrawWindow($hGuiTrans, 0, 0, 5) _WinAPI_RedrawWindow($hGui, 0, 0, 5) Sleep(10) WEnd Func _WM_ERASEBKGND($hWnd, $Msg, $wParam, $lParam) Switch $hWnd Case $hGuiTrans _LEDTXT_Draw($aLed1) _LEDTXT_Draw($aLed2) _LEDTXT_Draw($aLed3) _LEDTXT_Draw($aLed4) Case $hGui _LEDTXT_Draw($aLed5) EndSwitch Return True EndFunc ;==>_WM_ERASEBKGND Func _Exit() _LEDTXT_Destroy($aLed1) _LEDTXT_Destroy($aLed2) _LEDTXT_Destroy($aLed3) _LEDTXT_Destroy($aLed4) _LEDTXT_Destroy($aLed5) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit ; =============================== ; LEDTXT.au3 (by Eukalyptus) ; =============================== Func _LEDTXT_Step(ByRef $aLed, $iDir = 1) $aLed[6] -= $aLed[8] * $iDir Select Case $aLed[6] + $aLed[7] < 0 $aLed[6] = 0 Case $aLed[6] > 0 $aLed[6] = -$aLed[7] EndSelect EndFunc ;==>_LEDTXT_Step Func _LEDTXT_Draw($aLed) Local $iPos = Round($aLed[6]) - Mod(Round($aLed[6]), $aLed[8]) Switch $aLed[10] Case True Switch $iPos Case -$aLed[7] To -$aLed[7] + $aLed[4] _GDIPlus_GraphicsDrawImageRectRect($aLed[0], $aLed[1], -$iPos, 0, $iPos + $aLed[7], $aLed[5], $aLed[2], $aLed[3], $iPos + $aLed[7], $aLed[5]) If $aLed[6] + $aLed[7] < $aLed[4] Then _GDIPlus_GraphicsDrawImageRectRect($aLed[0], $aLed[1], 0, 0, $aLed[4] - ($iPos + $aLed[7]), $aLed[5], $aLed[2] + $iPos + $aLed[7], $aLed[3], $aLed[4] - ($iPos + $aLed[7]), $aLed[5]) Case Else _GDIPlus_GraphicsDrawImageRectRect($aLed[0], $aLed[1], -$iPos, 0, $aLed[4], $aLed[5], $aLed[2], $aLed[3], $aLed[4], $aLed[5]) EndSwitch Case Else Switch $iPos Case -$aLed[7] To -$aLed[7] + $aLed[4] _WinAPI_BitBlt($aLed[0], $aLed[2], $aLed[3], $aLed[2] + $iPos + $aLed[7], $aLed[5], $aLed[1], -$iPos, 0, $MERGECOPY) If $aLed[6] + $aLed[7] < $aLed[4] Then _WinAPI_BitBlt($aLed[0], $aLed[2] + $iPos + $aLed[7], $aLed[3], $aLed[4] - ($iPos + $aLed[7]), $aLed[5], $aLed[1], 0, 0, $MERGECOPY) Case Else _WinAPI_BitBlt($aLed[0], $aLed[2], $aLed[3], $aLed[4], $aLed[5], $aLed[1], -$iPos, 0, $MERGECOPY) EndSwitch EndSwitch EndFunc ;==>_LEDTXT_Draw Func _LEDTXT_Create_GdiPlus($hGui, $sText, $iX, $iY, $iW, $iH, $iType, $iLedW = 8, $iLedH = 8, $nLedOnCol1 = 0xFFFFAA00, $nLedOnCol2 = 0xFF000000, $nLedOffCol1 = 0xAA111122, $nLedOffCol2 = 0xAA000000, $nBkColor = 0xFF000000, $iDistW = 0, $iDistH = 0, $sFont = "Arial", $iTextSize = 0, $iTextOpt = 1, $iTextOffY = 0) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) Local $hLedOn = _LEDTXT_Create_Led($hGraphics, $iType, $iLedW - $iDistW, $iLedH - $iDistH, $nLedOnCol1, $nLedOnCol2) Local $hLedOff = _LEDTXT_Create_Led($hGraphics, $iType, $iLedW - $iDistW, $iLedH - $iDistH, $nLedOffCol1, $nLedOffCol2) Local $hLed, $iWidth $hLed = _LEDTXT_Create_Bmp($hGraphics, $sText, $iW, $iH, $iLedW, $iLedH, $hLedOn, $hLedOff, $iDistW, $iDistH, $sFont, $iTextSize, $iTextOpt, $iTextOffY, $nBkColor, $iWidth) Local $aReturn[11] $aReturn[0] = $hGraphics $aReturn[1] = $hLed $aReturn[2] = $iX $aReturn[3] = $iY $aReturn[4] = $iW $aReturn[5] = $iH $aReturn[6] = 0 $aReturn[7] = $iWidth $aReturn[8] = $iLedW + $iDistW $aReturn[9] = 0 $aReturn[10] = True ; True = _GdiPlus, False=_WinApi Return $aReturn EndFunc ;==>_LEDTXT_Create_GdiPlus Func _LEDTXT_Create_Gdi($hGui, $sText, $iX, $iY, $iW, $iH, $iType, $iLedW = 8, $iLedH = 8, $nLedOnCol1 = 0xFFFFAA00, $nLedOnCol2 = 0xFF000000, $nLedOffCol1 = 0xAA111122, $nLedOffCol2 = 0xAA000000, $nBkColor = 0xFF000000, $iDistW = 0, $iDistH = 0, $sFont = "Arial", $iTextSize = 0, $iTextOpt = 1, $iTextOffY = 0) Local $bGdiStarted = True If Not $__g_hGDIPDll Then $bGdiStarted = False _GDIPlus_Startup() EndIf Local $hDC = _WinAPI_GetDC($hGui) Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) Local $hLedOn = _LEDTXT_Create_Led($hGraphics, $iType, $iLedW - $iDistW, $iLedH - $iDistH, $nLedOnCol1, $nLedOnCol2) Local $hLedOff = _LEDTXT_Create_Led($hGraphics, $iType, $iLedW - $iDistW, $iLedH - $iDistH, $nLedOffCol1, $nLedOffCol2) Local $hLed, $iWidth $hLed = _LEDTXT_Create_Bmp($hGraphics, $sText, $iW, $iH, $iLedW, $iLedH, $hLedOn, $hLedOff, $iDistW, $iDistH, $sFont, $iTextSize, $iTextOpt, $iTextOffY, $nBkColor, $iWidth) Local $hBmpDC = _WinAPI_CreateCompatibleDC($hDC) Local $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hLed) _WinAPI_SelectObject($hBmpDC, $hBmp) Local $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hLed) Local $aReturn[11] $aReturn[0] = $hDC $aReturn[1] = $hBmpDC $aReturn[2] = $iX $aReturn[3] = $iY $aReturn[4] = $iW $aReturn[5] = $iH $aReturn[6] = 0 $aReturn[7] = $iWidth $aReturn[8] = $iLedW + $iDistW $aReturn[9] = $hBmp ; zum späteren destroy?! $aReturn[10] = False ; True = _GdiPlus, False=_WinApi _GDIPlus_GraphicsDispose($hGraphics) If Not $bGdiStarted Then _GDIPlus_Shutdown() Return $aReturn EndFunc ;==>_LEDTXT_Create_Gdi Func _LEDTXT_Destroy($aLed) Switch $aLed[10] Case True _GDIPlus_BitmapDispose($aLed[1]) _GDIPlus_GraphicsDispose($aLed[0]) Case Else _WinAPI_DeleteObject($aLed[9]) _WinAPI_ReleaseDC(0, $aLed[1]) _WinAPI_DeleteDC($aLed[0]) EndSwitch EndFunc ;==>_LEDTXT_Destroy Func _LEDTXT_Create_Bmp($hGraphics, $sText, $iW, $iH, $iLedW, $iLedH, $hLedOn, $hLedOff, $iDistW, $iDistH, $sFont, $iTextSize, $iTextOpt, $iTextOffY, $nBkColor, ByRef $iReturnW) $sText = StringReplace($sText, @LF, "") $iW -= Mod($iW, $iLedW + $iDistW) If Not $iTextSize Then $iTextSize = $iH Local $hFormat = _GDIPlus_StringFormatCreate() Local $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local $hFont = _GDIPlus_FontCreate($hFamily, $iTextSize, $iTextOpt, 2) Local $tLayout = _GDIPlus_RectFCreate($iW, 0, 0, 0) Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sText, $hFont, $tLayout, $hFormat) Local $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width")) + $iW $iWidth -= Mod($iWidth, $iLedW + $iDistW) Local $iHeight = $iH ;Ceiling(DllStructGetData($aInfo[0], "Height")) DllStructSetData($aInfo[0], "Y", $iTextOffY) Local $hBmpTxt = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Local $hBmpLed = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics) Local $hBmpTmp = _GDIPlus_BitmapCreateFromGraphics($iLedW, $iHeight, $hGraphics) Local $hGfxTxt = _GDIPlus_ImageGetGraphicsContext($hBmpTxt) Local $hGfxLed = _GDIPlus_ImageGetGraphicsContext($hBmpLed) Local $hGfxTmp = _GDIPlus_ImageGetGraphicsContext($hBmpTmp) Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) _GDIPlus_GraphicsClear($hGfxTxt, 0xFF000000) If $nBkColor Then _GDIPlus_GraphicsClear($hGfxLed, $nBkColor) _GDIPlus_GraphicsDrawStringEx($hGfxTxt, $sText, $hFont, $aInfo[0], $hFormat, $hBrush) Local $BitmapData = _GDIPlus_BitmapLockBits($hBmpTxt, $iW, 0, $iWidth - $iW, $iHeight, $GDIP_ILMREAD, $GDIP_PXF32ARGB) Local $Stride = DllStructGetData($BitmapData, "Stride") Local $Width = DllStructGetData($BitmapData, "Width") Local $Height = DllStructGetData($BitmapData, "Height") Local $Scan0 = DllStructGetData($BitmapData, "Scan0") Local $PixelData = DllStructCreate("ubyte lData[" & (Abs($Stride) * $Height - 1) & "]", $Scan0) If $hLedOff Then For $i = 0 To $Height - 1 Step $iLedH + $iDistH _GDIPlus_GraphicsDrawImage($hGfxTmp, $hLedOff, 0, $i) Next For $i = 0 To $iW - 1 Step $iLedW + $iDistW _GDIPlus_GraphicsDrawImage($hGfxLed, $hBmpTmp, $i, 0) Next EndIf For $col = 0 To $Width - 1 Step $iLedW + $iDistW If $hLedOff Then _GDIPlus_GraphicsDrawImage($hGfxLed, $hBmpTmp, $col + $iW, 0) For $row = 0 To $Height - 1 Step $iLedH + $iDistH If DllStructGetData($PixelData, 1, $row * $Stride + ($col * 4) + 1) Then _GDIPlus_GraphicsDrawImage($hGfxLed, $hLedOn, $col + $iW, $row) Next Next _GDIPlus_BitmapUnlockBits($hBmpTxt, $BitmapData) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BitmapDispose($hBmpTxt) _GDIPlus_GraphicsDispose($hGfxTxt) _GDIPlus_BitmapDispose($hBmpTmp) _GDIPlus_GraphicsDispose($hGfxTmp) _GDIPlus_GraphicsDispose($hGfxLed) $iReturnW = $iWidth Return $hBmpLed EndFunc ;==>_LEDTXT_Create_Bmp Func _LEDTXT_Create_Led($hGraphics, $iType, $iWidth, $iHeight, $nColor1, $nColor2) If Not $nColor1 And Not $nColor2 Then Return 0 Local $hBmp = _GDIPlus_BitmapCreateFromGraphics($iWidth + 1, $iHeight + 1, $hGraphics) Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBmp) Switch $iType Case 0 Local $hPen = _GDIPlus_PenCreate() Local $hPath = _GDIPlus_CreatePath() _GDIPlus_AddPathEllipse($hPath, 0, 0, $iWidth, $iHeight) Local $hBrushGrad = _GDIPlus_CreatePathGradientFromPath($hPath) _GDIPlus_SetLineGammaCorrection($hBrushGrad, True) _GDIPlus_SetPathGradientSurroundColorsWithCount($hBrushGrad, $nColor2) _GDIPlus_SetPathGradientCenterColor($hBrushGrad, $nColor1) _GDIPlus_FillPath($hGfx, $hBrushGrad, $hPath) _GDIPlus_ClosePathFigure($hPath) _GDIPlus_GraphicsDrawEllipse($hGfx, 0, 0, $iWidth, $iHeight, $hPen) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrushGrad) _GDIPlus_PathDispose($hPath) Case 1 Local $hPen = _GDIPlus_PenCreate() Local $hPath = _GDIPlus_CreatePath() _GDIPlus_AddPathRectangle($hPath, 0, 0, $iWidth, $iHeight) Local $hBrushGrad = _GDIPlus_CreatePathGradientFromPath($hPath) _GDIPlus_SetLineGammaCorrection($hBrushGrad, True) _GDIPlus_SetPathGradientSurroundColorsWithCount($hBrushGrad, $nColor2) _GDIPlus_SetPathGradientCenterColor($hBrushGrad, $nColor1) _GDIPlus_FillPath($hGfx, $hBrushGrad, $hPath) _GDIPlus_ClosePathFigure($hPath) _GDIPlus_GraphicsDrawRect($hGfx, 0, 0, $iWidth, $iHeight, $hPen) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrushGrad) _GDIPlus_PathDispose($hPath) Case 2 If $nColor1 Then Local $hBrush = _GDIPlus_BrushCreateSolid($nColor1) _GDIPlus_GraphicsFillEllipse($hGfx, 0, 0, $iWidth, $iHeight, $hBrush) _GDIPlus_BrushDispose($hBrush) EndIf If $nColor2 Then Local $hPen = _GDIPlus_PenCreate($nColor2) _GDIPlus_GraphicsDrawEllipse($hGfx, 0, 0, $iWidth, $iHeight, $hPen) _GDIPlus_PenDispose($hPen) EndIf Case 3 If $nColor1 Then Local $hBrush = _GDIPlus_BrushCreateSolid($nColor1) _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $iWidth, $iHeight, $hBrush) _GDIPlus_BrushDispose($hBrush) EndIf If $nColor2 Then Local $hPen = _GDIPlus_PenCreate($nColor2) _GDIPlus_GraphicsDrawRect($hGfx, 0, 0, $iWidth, $iHeight, $hPen) _GDIPlus_PenDispose($hPen) EndIf EndSwitch _GDIPlus_GraphicsDispose($hGfx) Return $hBmp EndFunc ;==>_LEDTXT_Create_Led Func _GDIPlus_CreatePath($brushMode = 0) Local $hPath $hPath = DllCall($__g_hGDIPDll, "int", "GdipCreatePath", "int", $brushMode, "handle*", 0) If @error Then Return SetError(1, @error, 0) Return SetError($hPath[0], 0, $hPath[2]) EndFunc ;==>_GDIPlus_CreatePath Func _GDIPlus_AddPathEllipse($hPath, $iX, $iY, $iWidth, $iHeight) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipAddPathEllipse", "handle", $hPath, "float", $iX, "float", $iY, "float", $iWidth, "float", $iHeight) If @error Then Return SetError(1, @error, 0) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_GDIPlus_AddPathEllipse Func _GDIPlus_AddPathRectangle($hPath, $iX, $iY, $iWidth, $iHeight) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipAddPathRectangle", "handle", $hPath, "float", $iX, "float", $iY, "float", $iWidth, "float", $iHeight) If @error Then Return SetError(1, @error, 0) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_GDIPlus_AddPathRectangle Func _GDIPlus_CreatePathGradientFromPath($hPath) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreatePathGradientFromPath", "handle", $hPath, "int*", 0) If @error Then Return SetError(1, @error, 0) Return SetError($aResult[0], 0, $aResult[2]) EndFunc ;==>_GDIPlus_CreatePathGradientFromPath Func _GDIPlus_SetLineGammaCorrection($hBrush, $useGammaCorrection = True) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipSetLineGammaCorrection", "handle", $hBrush, "int", $useGammaCorrection) If @error Then Return SetError(1, @error, 0) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_GDIPlus_SetLineGammaCorrection Func _GDIPlus_SetPathGradientCenterColor($hBrush, $iARGB) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipSetPathGradientCenterColor", "handle", $hBrush, "int", $iARGB) If @error Then Return SetError(1, @error, 0) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_GDIPlus_SetPathGradientCenterColor Func _GDIPlus_FillPath($hGraphic, $hBrushGrad, $hPath) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipFillPath", "handle", $hGraphic, "handle", $hBrushGrad, "handle", $hPath) If @error Then Return SetError(1, @error, 0) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_GDIPlus_FillPath Func _GDIPlus_SetPathGradientSurroundColorsWithCount($hBrush, $aArgb) Local $iI, $iCount, $aResult, $res, $x, $pArgb If IsArray($aArgb) Then $iCount = UBound($aArgb) $tArgb = DllStructCreate("int[" & $iCount & "]") $pArgb = DllStructGetPtr($tArgb) For $iI = 0 To $iCount - 1 DllStructSetData($tArgb, 1, $aArgb[$iI], $iI + 1) Next Else $iCount = 1 $tArgb = DllStructCreate("int") $pArgb = DllStructGetPtr($tArgb) DllStructSetData($tArgb, 1, $aArgb, 1) EndIf $aResult = DllCall($__g_hGDIPDll, "int", "GdipSetPathGradientSurroundColorsWithCount", "handle", $hBrush, "int", $pArgb, "int*", $iCount) If @error Then Return SetError(1, @error, 0) Return SetError($aResult[0], $aResult[3], $aResult[0] = 0) EndFunc ;==>_GDIPlus_SetPathGradientSurroundColorsWithCount Func _GDIPlus_ClosePathFigure($hPath) Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath) If @error Then Return SetError(1, @error, 0) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>_GDIPlus_ClosePathFigure Func __GDIPlus_PathDispose($hPath) Local $aResult = DllCall($__g_hGDIPDll, "uint", "GdipDeletePath", "handle", $hPath) If @error Then Return SetError(1, @error, 0) Return SetError($aResult[0], 0, $aResult[0] = 0) EndFunc ;==>__GDIPlus_PathDispose
  12. you can set the path for that directory in the second parameter of the "CreateCoreWebView2EnvironmentWithOptions" function call. That path must be writable or else an error will be thrown. take a look here: https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/?do=findComment&comment=1475295 ... and also here: What is the 'EBWebView' folder created for? · Issue #2023 · MicrosoftEdge/WebView2Feedback · GitHub
  13. Hi @MattyD,First of all, thank you for this work you are doing. From a first look at the WinRT UDF, I see that the _WinRT_WaitForAsync function is used to block the execution of the main script until the expected event is raised (or expires). I would like to ask you if there is a way to use something similar to the AutoIt ObjEvent() function as an alternative (or maybe, even better, use that function directly). That is, give the user the possibility to pass the name of their own function attached to an event that will be called asynchronously when that event occurs? I apologize in advance if I misunderstood the mechanism of the _WinRT_WaitForAsync() function ... bye and thank you
  14. with the changes suggested by @UEZ it works for me try putting #AutoIt3Wrapper_UseX64=n at the beginning of the script
  15. Hi @Blaxxun, ... if you want to try something similar you can take a look at my _crop() function found here: https://www.autoitscript.com/forum/topic/203545-%E2%9C%82%EF%B8%8F-quick-crop-tool Below is a simple script if you're interested in trying it out. I hope it can be of use to you. #include <GUIConstantsEx.au3> #include <croptool.au3> ; <-- https://www.autoitscript.com/forum/topic/203545-%E2%9C%82%EF%B8%8F-quick-crop-tool Opt("GUICloseOnESC", 0) ; Simple example of use of the _Crop() function ; ; it allows you to freely and visually select an area of the screen ; ; - To resize the area click the left mouse button on any of the moving colored edges of the tool and drag. ; You can also LeftClick within the selected area and drag to move the whole selector. ; ; - To terminate the selection operation RightClick within the selected area. ; ; You can alse terminate the selection operation by hitting the ESC key; ; in that case the @extended macro will be setted to true Example() Func Example() ; Create an example GUI Local $hGui = GUICreate("Crop Demo", 220, 105, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) ; Create buttons Local $Crop = GUICtrlCreateButton("Start cropping", 10, 10, 200, 25) Local $Crop_hide_me = GUICtrlCreateButton("Hide me and crop", 10, 40, 200, 25) Local $Close = GUICtrlCreateButton("Close", 10, 70, 200, 25) ; Display the example GUI GUISetState(@SW_SHOW, $hGui) Local $aSelection = 0, $bExtended = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Close ExitLoop Case $Crop ; start the crop tool $aSelection = _crop() $bExtended = @extended Case $Crop_hide_me ; hide this gui and start the crop tool GUISetState(@SW_HIDE, $hGui) $aSelection = _crop() $bExtended = @extended GUISetState(@SW_SHOW, $hGui) EndSwitch If $bExtended Then MsgBox(48, "Esc pressed", "no crop area selected") $aSelection = '' $bExtended = 0 EndIf If IsArray($aSelection) Then MsgBox(64, 'Coordinates of the selected area', _ "UpperLeft X : " & $aSelection[0] & @CRLF & _ "UpperLeft Y : " & $aSelection[1] & @CRLF & _ "Width : " & $aSelection[2] & @CRLF & _ "Height : " & $aSelection[3]) $aSelection = '' EndIf WEnd ; Delete the GUI GUIDelete($hGui) EndFunc ;==>Example
×
×
  • Create New...