Jump to content

Gianni

MVPs
  • Posts

    2,641
  • Joined

  • Last visited

  • Days Won

    34

Gianni last won the day on March 10

Gianni had the most liked content!

7 Followers

About Gianni

  • Birthday 05/02/1962

Profile Information

  • Location
    Italy

Recent Profile Visitors

3,494 profile views

Gianni's Achievements

  1. that output looks like a string containing ANSI escape codes where is it displayed, on the AutoIt console or on the "ollama" console? by the way, what is "ollama" and where do you download it? ... Sorry, just saw the link in the listing ...
  2. ...it would be useful to modify the main window so that, instead of adapting to the size of the loaded image, it should allow you to load the image in a fixed-size (and/or resizable) window, allowing you to scroll the image within it. ...
  3. more ideas, more fun... 🙂 added a crop and copy to clipboard function (UDF download required. see link in list) I hope there are no bugs ;Coded by UEZ 2024-03-16 ; [few mods by Gianni :) ] #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Clipboard.au3> #include <ScreenCapture.au3> #include <.\CropTool.au3> ; <-- get this from below link ; https://www.autoitscript.com/forum/topic/203545-%E2%9C%82%EF%B8%8F-quick-crop-tool/ Opt("GUICloseOnESC", 0) ; --- rulers ----- Global $iThickness = 5 Global $hGUI1 = GUICreate("", @DesktopWidth, $iThickness, 0, @DesktopHeight / 2, $WS_POPUP, $WS_EX_TOPMOST) GUICtrlCreateLabel("", 0, 0, @DesktopWidth, $iThickness, -1, $GUI_WS_EX_PARENTDRAG) GUISetBkColor(0x00ff00, $hGUI1) WinSetTrans($hGUI1, "", 127) GUISetState(@SW_HIDE, $hGUI1) Global $hGUI2 = GUICreate("", $iThickness, @DesktopHeight, @DesktopWidth / 2, 0, $WS_POPUP, $WS_EX_TOPMOST) GUICtrlCreateLabel("", 0, 0, $iThickness, @DesktopHeight, -1, $GUI_WS_EX_PARENTDRAG) GUISetBkColor(0x00ff00, $hGUI2) WinSetTrans($hGUI2, "", 127) GUISetState(@SW_HIDE, $hGUI2) ; ---------------- Global $sFile = "cover.jpg" ; FileOpenDialog("Select an image", "", "Images (*.jpg;*.png;*.gif;*.bmp)") If @error Then Exit Global $aRect, $bResult, $hBmp, $aTemp, $bPreviousStatus, $aBKcolor[2] = [0x008800, 0x00ff00] _GDIPlus_Startup() Global $hImage = _GDIPlus_ImageLoadFromFile($sFile) Global $aDim = _GDIPlus_ImageGetDimension($hImage) Global Const $hGUI = GUICreate("Image Rotate", $aDim[0], $aDim[1] + 50) Global Const $hDC = _WinAPI_GetDC($hGUI) Global Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aDim[0], $aDim[1]) Global Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Global Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Global Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) Global Const $hPen = _GDIPlus_PenCreate(0xFFFFFFFF) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, 4) _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $aDim[0], $aDim[1]) Global $hButton1 = GUICtrlCreateButton(' < ', 10, $aDim[1] + 10, 40) GUICtrlSetTip(-1, 'fine rotation to the left') Global $Slider = GUICtrlCreateSlider(60, $aDim[1] + 10, 360, 25) GUICtrlSetLimit(-1, 360, 0) ; change min/max value GUICtrlSetTip(-1, 'slide to rotate the image') Global $hButton2 = GUICtrlCreateButton(' > ', 430, $aDim[1] + 10, 40) GUICtrlSetTip(-1, 'fine rotation to the right') Global $hCrop = GUICtrlCreateButton(' # ', 480, $aDim[1] + 10, 40) GUICtrlSetTip(-1, '1) move & resize the tool' & @CR & '2) right-click inside the tool area to copy the image' & @CR & '3) hit ESC to cancel cropping', 'Crop Tool') Global $hButton3 = GUICtrlCreateButton(' + ', 530, $aDim[1] + 10, 40) GUICtrlSetBkColor(-1, $aBKcolor[_SwitcRuler()]) GUICtrlSetTip(-1, 'show/hide ruler') Global $hSlider = GUICtrlGetHandle($Slider) Global $Dummy = GUICtrlCreateDummy() GUIRegisterMsg($WM_HSCROLL, "WM_HVSCROLL") ;horz slider GUISetState(@SW_SHOW, $hGUI) _ImageRefresh() ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Dummy _GDIPlus_ImageRotate($hImage, GUICtrlRead($Slider)) _ImageRefresh() Case $hButton1 _FineTuning(1) Case $hButton2 _FineTuning(2) Case $hCrop $bPreviousStatus = _SwitcRuler(0) $aTemp = WinGetPos($hGUI) $aRect = _Crop($aTemp[0] + ($aTemp[2] / 2) - 50, $aTemp[1] + ($aTemp[3] / 2) - 50) If Not @extended Then ; below snippet by UEZ ; https://www.autoitscript.com/forum/topic/129333-screen-capture-to-clipboard/?do=findComment&comment=898287 $hBmp = _ScreenCapture_Capture('', $aRect[0], $aRect[1], $aRect[0] + $aRect[2] - 1, $aRect[1] + $aRect[3] - 1, False) $bResult = _ClipBoard_Open(0) + _ClipBoard_Empty() + Not _ClipBoard_SetDataEx($hBmp, $CF_BITMAP) _ClipBoard_Close() If $bResult = 2 Then MsgBox($MB_ICONINFORMATION, '', "the area was copied to the clipboard", 2) Else MsgBox($MB_ICONERROR, '', "Something went wrong", 2) EndIf Else EndIf _SwitcRuler($bPreviousStatus) Case $hButton3 _SwitcRuler(Not _SwitcRuler()) GUICtrlSetBkColor($hButton3, $aBKcolor[_SwitcRuler()]) EndSwitch WEnd _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_PenDispose($hPen) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Func _FineTuning($iDirection) Local Static $iAngle Local Static $iSliderPos = GUICtrlRead($Slider) If $iSliderPos <> GUICtrlRead($Slider) Then $iAngle = 0 $iSliderPos = GUICtrlRead($Slider) EndIf Switch $iDirection Case 1 $iAngle -= .1 If $iAngle < 0 Then $iAngle = .9 $iSliderPos -= 1 If $iSliderPos < 0 Then $iSliderPos = 359 GUICtrlSetData($Slider, $iSliderPos) EndIf Case 2 $iAngle += .1 If $iAngle > .9 Then $iAngle = 0 $iSliderPos += 1 If $iSliderPos > 359 Then $iSliderPos = 0 GUICtrlSetData($Slider, $iSliderPos) EndIf EndSwitch _GDIPlus_ImageRotate($hImage, $iSliderPos + $iAngle) _ImageRefresh() EndFunc ;==>_FineTuning Func _ImageRefresh() _GDIPlus_GraphicsClear($hCanvas) _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $aDim[0], $aDim[1]) _WinAPI_BitBlt($hDC, 0, 0, $aDim[0], $aDim[1], $hDC_backbuffer, 0, 0, $SRCCOPY) EndFunc ;==>_ImageRefresh Func _SwitcRuler($bOn = 2) Local Static $bStatus = 0 Local $bReturn = $bStatus If $bOn = 1 Then GUISetState(@SW_SHOW, $hGUI1) GUISetState(@SW_SHOW, $hGUI2) $bStatus = 1 ElseIf $bOn = 0 Then GUISetState(@SW_HIDE, $hGUI1) GUISetState(@SW_HIDE, $hGUI2) $bStatus = 0 EndIf ; Else Return $bReturn EndFunc ;==>_SwitcRuler Func _GDIPlus_ImageRotate($hImage, $fDegree) ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $fDegree = ' & $fDegree & @TAB & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $aDim[0] / 2, $aDim[1] / 2) _GDIPlus_MatrixRotate($hMatrix, $fDegree) _GDIPlus_MatrixTranslate($hMatrix, -$aDim[0] / 2, -$aDim[1] / 2) _GDIPlus_GraphicsSetTransform($hCanvas, $hMatrix) _GDIPlus_MatrixDispose($hMatrix) EndFunc ;==>_GDIPlus_ImageRotate Func WM_HVSCROLL($hwnd, $iMsg, $wParam, $lParam) #forceref $hwnd, $iMsg, $wParam, $lParam Switch $iMsg Case $WM_HSCROLL Switch $lParam Case $hSlider GUICtrlSendToDummy($Dummy, GUICtrlRead($Slider)) EndSwitch Case $WM_VSCROLL EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_HVSCROLL
  4. @UEZ, nice. I've fiddled with the UEZ listing a bit you can now rotate the image visually with a slider you can also finely adjust the rotation with two buttons I also added 2 "rulers", one vertical and one horizontal, which you can move by clicking on them and dragging them, in order to have a reference to control the orientation of the image ;Coded by UEZ 2024-03-16 ; [few mods by Gianni :) ] #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ; --- rulers ----- Global $iThickness = 4 Global $hGUI1 = GUICreate("", @DesktopWidth, $iThickness, 0, @DesktopHeight / 2, $WS_POPUP, $WS_EX_TOPMOST) GUICtrlCreateLabel("", 0, 0, @DesktopWidth, $iThickness, -1, $GUI_WS_EX_PARENTDRAG) GUISetBkColor(0x00ff00, $hGUI1) WinSetTrans($hGUI1, "", 127) GUISetState(@SW_SHOW, $hGUI1) Global $hGUI2 = GUICreate("", $iThickness, @DesktopHeight, @DesktopWidth / 2, 0, $WS_POPUP, $WS_EX_TOPMOST) GUICtrlCreateLabel("", 0, 0, $iThickness, @DesktopHeight, -1, $GUI_WS_EX_PARENTDRAG) GUISetBkColor(0x00ff00, $hGUI2) WinSetTrans($hGUI2, "", 127) GUISetState(@SW_SHOW, $hGUI2) ; ---------------- Global $sFile = "cover.jpg" ;FileOpenDialog("Select an image", "", "Images (*.jpg;*.png;*.gif;*.bmp)") If @error Then Exit Const $fPI = ACos(-1) _GDIPlus_Startup() Global $hImage = _GDIPlus_ImageLoadFromFile($sFile) Global $aDim = _GDIPlus_ImageGetDimension($hImage) Global Const $hGUI = GUICreate("Image Rotate", $aDim[0], $aDim[1] + 50) Global Const $hDC = _WinAPI_GetDC($hGUI) Global Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $aDim[0], $aDim[1]) Global Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Global Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Global Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) Global Const $hPen = _GDIPlus_PenCreate(0xFFFFFFFF) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, 4) _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $aDim[0], $aDim[1]) Global $hButton1 = GUICtrlCreateButton(' < ', 10, $aDim[1] + 10, 40) Global $Slider = GUICtrlCreateSlider(60, $aDim[1] + 10, 360, 25) GUICtrlSetLimit(-1, 360, 0) ; change min/max value Global $hButton2 = GUICtrlCreateButton(' > ', 430, $aDim[1] + 10, 40) Global $hSlider = GUICtrlGetHandle($Slider) Global $Dummy = GUICtrlCreateDummy() GUIRegisterMsg($WM_HSCROLL, "WM_HVSCROLL") ;horz slider GUISetState(@SW_SHOW, $hGUI) _ImageRefresh() ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Dummy _GDIPlus_ImageRotate($hImage, GUICtrlRead($Slider)) _ImageRefresh() Case $hButton1 _FineTuning(1) Case $hButton2 _FineTuning(2) EndSwitch WEnd _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_PenDispose($hPen) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Func _FineTuning($iDirection) Local Static $iAngle Local Static $iSliderPos = GUICtrlRead($Slider) If $iSliderPos <> GUICtrlRead($Slider) Then $iAngle = 0 $iSliderPos = GUICtrlRead($Slider) EndIf Switch $iDirection Case 1 $iAngle -= .1 If $iAngle < 0 Then $iAngle = .9 $iSliderPos -= 1 If $iSliderPos < 0 Then $iSliderPos = 359 GUICtrlSetData($Slider, $iSliderPos) EndIf Case 2 $iAngle += .1 If $iAngle > .9 Then $iAngle = 0 $iSliderPos += 1 If $iSliderPos > 359 Then $iSliderPos = 0 GUICtrlSetData($Slider, $iSliderPos) EndIf EndSwitch _GDIPlus_ImageRotate($hImage, $iSliderPos + $iAngle) _ImageRefresh() EndFunc ;==>_FineTuning Func _ImageRefresh() _GDIPlus_GraphicsClear($hCanvas) _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $aDim[0], $aDim[1]) _WinAPI_BitBlt($hDC, 0, 0, $aDim[0], $aDim[1], $hDC_backbuffer, 0, 0, $SRCCOPY) EndFunc ;==>_ImageRefresh Func _GDIPlus_ImageRotate($hImage, $fDegree) ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $fDegree = ' & $fDegree & @TAB & '>Error code: ' & @error & @CRLF) ;### Debug Console Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $aDim[0] / 2, $aDim[1] / 2) _GDIPlus_MatrixRotate($hMatrix, $fDegree) _GDIPlus_MatrixTranslate($hMatrix, -$aDim[0] / 2, -$aDim[1] / 2) _GDIPlus_GraphicsSetTransform($hCanvas, $hMatrix) _GDIPlus_MatrixDispose($hMatrix) EndFunc ;==>_GDIPlus_ImageRotate Func WM_HVSCROLL($hwnd, $iMsg, $wParam, $lParam) #forceref $hwnd, $iMsg, $wParam, $lParam Switch $iMsg Case $WM_HSCROLL Switch $lParam Case $hSlider GUICtrlSendToDummy($Dummy, GUICtrlRead($Slider)) EndSwitch Case $WM_VSCROLL EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_HVSCROLL
  5. here is a small and funny script to quickly test your CSS file "on the fly" (no need to compile the help), save your CSS file along this script. just run this script while autoit help is open. The script sets the CSS parameters for the pages as you browse them. #include <IE.au3> Global $oIE Global $sMyCSS = FileRead(".\AutoItHelp.css") ; Your custom CSS file _Example() Func _Example() Local $sHelpVersion = "AutoIt Help (v3.3.16.1)" ; get this from the Help window's title bar Local $hWND = WinGetHandle($sHelpVersion) ; handle of the AutoIt Help window If Not WinExists($hWND) Then Return MsgBox(0, 'Help not found', "no AutoIt Help running", 3) $oIE = _IEAttach($hWND, "embedded") ; get reference to the BrowserControl embedded in the Help If @error Then Return MsgBox(0, 'Browser Control error', "problems on attaching Browser Control", 3) ; Set your custom CSS settings _WebBrowser_CSS_Inject($oIE, $sMyCSS) ; get a reference to the browser's window (for event management purpose) Local $oWindow = $oIE.document.parentwindow ; setup an event management Local $Event = ObjEvent($oWindow, "IEEvent_", 'HTMLWindowEvents') While WinExists($hWND) ; stay alive only while the help is running GUIGetMsg() ; just to delay the CPU load WEnd Return MsgBox(0, '', "AutoIt Help closed", 3) EndFunc ;==>_Example ; following function is fired each time the Help page changes Volatile Func IEEvent_onload($oEvent) ; ConsoleWrite("Debug: onload event" & @crlf) _WebBrowser_CSS_Inject($oIE, $sMyCSS) ; ; apply your custom CSS setting to the loaded page EndFunc ;==>IEEvent_onload ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WebBrowser_CSS_Inject ; Description ...: this function creates into the html document a CSS node element with embedded the passed CSS or a link to a CSS ; Syntax ........: _WebBrowser_CSS_Inject(Byref $oIE_Server, $sStylesheet[, $bIsUrl = False]) ; Parameters ....: $oIE_Server - a Webbrowser object reference. ; $sStylesheet - CSS source to be injected into the page (either, a CSS or an URL (a link to a CSS) ; $bIsUrl - [optional] True if above parameter is an URL (a link to a CSS source). Default is False. ; Return values .: A Node Object reference, representing the appended node ; Author ........: Gianni ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _WebBrowser_CSS_Inject(ByRef $oIE_Server, $sStylesheet, $bIsUrl = False) ; Inject css Local $oStyleNode Local $objDocument = $oIE_Server.document ; If $bIsUrl Then ; use the link to load a stylesheet $oStyleNode = $objDocument.createElement('link') ; // Creates <link /> $oStyleNode.type = "text/css" $oStyleNode.rel = 'stylesheet' $oStyleNode.href = $sStylesheet Else ; inject the stylesheet directly $oStyleNode = $objDocument.createElement('style') ; // Creates <style></style> $oStyleNode.type = 'text/css' $oStyleNode.styleSheet.cssText = $sStylesheet ; // Syntax for IE EndIf ; Local $oNode = $objDocument.getElementsByTagName('head').item(0).appendChild($oStyleNode) If $bIsUrl Then ; wait till css has been downloaded Do Sleep(250) ; ConsoleWrite('css: ' & $oNode.ReadyState & @CRLF) ; debug purpose Until $oNode.ReadyState = "loaded" Or $oNode.ReadyState = "complete" EndIf Return $oNode EndFunc ;==>_WebBrowser_CSS_Inject
  6. I don't remember where I found it and I don't know if it can be useful here: if you save the following command line in a file with the .vbs extension and then execute it, each time it is executed it switches the audio from ON to OFF and vice versa (it toggles the audio state with each execution) CreateObject("WScript.Shell").SendKeys(chr(173))
  7. thanks @Nine 👍 .... you're right, it's better not to forget $STDIN_CHILD...
  8. .. ? .. I don't get StdoutRead() .. P.S. Script Fixed, (thanks to @nine ... see post below this) Local $sFile1 = "img1.bmp" Local $sFile2 = "img2.bmp" ; Local $sCmd = @ComSpec & " /c " & 'fc.exe /b ' & $sFile1 & ' ' & $sFile2 Local $sCmd = 'fc.exe /b ' & $sFile1 & ' ' & $sFile2 Local $sOut Local $h = Run($sCmd, '.', '', 0x1 + 0x8) ; $STDIN_CHILD (0x1) + $STDERR_MERGED (0x8) Do ConsoleWrite('.') ; just for debug $sOut &= StdoutRead($h) Until Not ProcessExists($h) ConsoleWrite($sOut & @CRLF)
  9. here a minimalist version... gets the same result as fc.exe but much much slower... Local $sFile1 = "img1.bmp" Local $sFile2 = "img2.bmp" Local $hFile = FileOpen($sFile1, 16) ; 16 = binary mode Local $sBinData = FileRead($hFile) Local $iBytes1 = @extended FileClose($hFile) ConsoleWrite($sFile1 & ' = ' & $iBytes1 & @CRLF) Local $tBytes1 = DllStructCreate("byte[" & $iBytes1 & "]") DllStructSetData(($tBytes1), 1, $sBinData) $hFile = FileOpen($sFile2, 16) $sBinData = FileRead($hFile) Local $iBytes2 = @extended FileClose($hFile) ConsoleWrite($sFile2 & ' = ' & $iBytes2 & @CRLF) Local $tBytes2 = DllStructCreate("byte[" & $iBytes2 & "]") DllStructSetData(($tBytes2), 1, $sBinData) ; If $iBytes1 <> $iBytes2 Then Exit ; 2 files have <> len For $i = 1 To $iBytes1 $BYTE1 = DllStructGetData($tBytes1, 1, $i) $BYTE2 = DllStructGetData($tBytes2, 1, $i) If $BYTE1 <> $BYTE2 Then ConsoleWrite(Hex($i - 1) & ": " & Hex($BYTE1, 2) & ' ' & Hex($BYTE2, 2) & @CRLF) EndIf Next
  10. you are calling the setDate() function in response to the $MCN_SELCHANGE event. This event fires when you change the month and consequently setDate() fires when the user changes the month. simply don't call setDate() in response to the $MCN_SELCHANGE event and the problem shouldn't arise. hope it helps Switch $iCode Case $MCN_SELCHANGE ; Sent by a month calendar control when the currently selected date or range of dates changes ; setDate() ; <== comment out this line Case $MCN_SELECT setDate() EndSwitch
  11. no need to include "ResourcesEx.au3" just try replacing this line $hImage = _Resource_GetAsImage("TEST_PNG_1") with this other one $hImage = _GDIPlus_ImageLoadFromFile(".\test.png")
  12. A sort of billboard based on the Edge browser and 'served' by AutoIt. Main script engine taken from this post by @Danyfirex: https://www.autoitscript.com/forum/topic/207856-show-parsed-html-code-in-default-browser-not-ie-moved/?do=findComment&comment=1499455 Basically the smallest embedded web server ever. Obviously the content displayed in the browser is generated by the HTML/CSS/Javascript listing embedded in the AutoIt script. AutoIt simply runs msEdge and "serves" the web page. Nothing special, but an interesting way to contain everything in one file. Reports of errors and suggestions for improvements are welcome Cheers P.S. To easily adapt and prepare the HTML listing, ready to be embedded into the AutoIt listing, see this other post: https://www.autoitscript.com/forum/topic/204362-microsoft-edge-webview2-embed-web-code-in-your-native-application/?do=findComment&comment=1474817 #cs a kind of billboard based on Edge browser and 'served' by AutoIt Main script engine taken from this post by @Danyfirex: https://www.autoitscript.com/forum/topic/207856-show-parsed-html-code-in-default-browser-not-ie-moved/?do=findComment&comment=1499455 basically the smallest embedded web server ever #ce OnAutoItExitRegister('_Done') _EdgeBroswerLoadPage() Func _EdgeBroswerLoadPage() Local $sUrl = "http://127.0.0.1:80" TCPStartup() ; https://learn.microsoft.com/en-us/deployedge/microsoft-edge-configure-kiosk-mode ; https://developer.chrome.com/blog/autoplay ; $pid = Run('"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --app=' & $sUrl & ' --kiosk --edge-kiosk-type=public-browsing --no-first-run --window-size="800,800" --kiosk-idle-timeout-minutes=0 --autoplay-policy=no-user-gesture-required') $pid = Run(@ComSpec & " /c start msedge.exe --app=" & $sUrl & ' --kiosk --edge-kiosk-type=public-browsing --no-first-run --window-size="800,800" --kiosk-idle-timeout-minutes=0 --autoplay-policy=no-user-gesture-required', '', @SW_HIDE) Local $iTimer = TimerInit(), $bTimeout = False, $iMaxWait = 5000 Do Sleep(250) $hEdgeHostWin = WinGetHandle("[CLASS:Chrome_WidgetWin_1]", "Chrome Legacy Window") $bTimeout = TimerDiff($iTimer) > $iMaxWait Until (IsHWnd($hEdgeHostWin) Or $bTimeout) If $bTimeout Then Exit MsgBox(0, 'Error', "Problem on starting MsEdge.") WinMove($hEdgeHostWin, '', (@DesktopWidth / 2 - 400), (@DesktopHeight / 2) - 400, 800, 800) $iConnectedSocket = _ConnectToSock() If @error Then Exit _Done() TCPSend($iConnectedSocket, StringToBinary(_GetSource(), 4)) Sleep(5000) TCPCloseSocket($iConnectedSocket) EndFunc ;==>_EdgeBroswerLoadPage Func _ConnectToSock() Local $iConnectedSocket = -1 Local $hTimer = TimerInit() Local $bErrorTimeout = False Local $iMySocket = TCPListen("127.0.0.1", 80) Do Sleep(300) $iConnectedSocket = TCPAccept($iMySocket) If TimerDiff($hTimer) > (1000 * 5) Then $bErrorTimeout = True ConsoleWrite('Error connect sock' & @CRLF) ExitLoop EndIf Until $iConnectedSocket <> -1 If $bErrorTimeout Then TCPShutdown() Return SetError(1, 0, "Error connect sock") EndIf TCPRecv($iConnectedSocket, 1024) ; ConsoleWrite($iConnectedSocket & @CRLF) Return $iConnectedSocket EndFunc ;==>_ConnectToSock Func _GetSource() Local $sPeace = "Peace;Paz;Paix;Frieden;Pace;Paz;Vrede;Fred;Мир;平和;和平;سلام;शांति;평화;Hòa bình;Mír;Barış;שלום;സമാധാനം;صلح;សន្តិភាព;" & _ "Amani;Uxolo;Aman;Rauha;Pokój;Beke;Мир;ප්‍රාථමික;සාමය;Pokój;สันติภาพ;సమాధానం;Aşiti;Rukuhia;Afioun;Rahu;Barış;Paqe;Paqe;Víðir;Rau;" & _ "Mír;Kalinaw;Salaam;Kapayapaan;ප්‍රාථමිකයාගේ;Miers;ཞི་གནས;Barış;Heddwch;मानसिक शांति;Shanti;Paghi;Pokoj;روابط داشتن;השקט;Fred;ཞི་བའི་གནས;" & _ "Mir;Hòu-î;Peac;Aaman;واپسی;Rauhaa;Iřiwa;سكينة;Hapus;Mirë;صلح، امن;Santiphap;Paix;Amani;Ashtari;Pangaduan;Мир;Sülh;שאלווע;శాంతి;" & _ "Udo;Beke;Uhuru;Irimë;ಶಾಂತಿ;Hasiti;Kọọkan;Milgħuba;ເສືອດສະຫວັນ;Kapayapaan;راحت;Peis;Rāmā;Udo;မြောက်ရိုးရာ;ප්‍රාථමික;Laipni;Rahu;ਸ਼ਾਂਤੀ;Paqe;Pax;Paz;Mir;صلح;" $sPeace = StringReplace($sPeace, ";", " ") Local $sSource = "" $sSource &= "<!doctype html>" & @CRLF $sSource &= "<html lang=""en"">" & @CRLF $sSource &= "<head>" & @CRLF $sSource &= "<meta charset=""utf-8"">" & @CRLF $sSource &= "<title>Peace</title>" & @CRLF $sSource &= "<style>" & @CRLF $sSource &= "/* ---- cube---- */" & @CRLF $sSource &= "/* https://3dtransforms.desandro.com/ */" & @CRLF $sSource &= ".cube {" & @CRLF $sSource &= " width: 200px;" & @CRLF $sSource &= " height: 200px;" & @CRLF $sSource &= " position: relative;" & @CRLF $sSource &= " transform-style: preserve-3d;" & @CRLF $sSource &= " transform: translateZ(-100px);" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".scene--hero {" & @CRLF $sSource &= " height: 200px;" & @CRLF $sSource &= " margin: 180px;" & @CRLF $sSource &= " perspective: 500px;" & @CRLF $sSource &= " border: none;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube--hero {" & @CRLF $sSource &= " margin: 0 auto;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube.is-spinning {" & @CRLF $sSource &= " animation: spinCube 8s infinite ease-in-out;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= "@keyframes spinCube {" & @CRLF $sSource &= " 0% { transform: translateZ(-100px) rotateX( 0deg) rotateY( 0deg); }" & @CRLF $sSource &= " 100% { transform: translateZ(-100px) rotateX(360deg) rotateY(720deg); }" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube__face {" & @CRLF $sSource &= " position: absolute;" & @CRLF $sSource &= " width: 200px;" & @CRLF $sSource &= " height: 200px;" & @CRLF $sSource &= " border: 2px solid black;" & @CRLF $sSource &= " line-height: 200px;" & @CRLF $sSource &= " font-size: 100px;" & @CRLF $sSource &= " font-weight: bold;" & @CRLF $sSource &= " color: white;" & @CRLF $sSource &= " text-align: center;" & @CRLF $sSource &= " backface-visibility: hidden;" & @CRLF $sSource &= "}" & @CRLF $sSource &= "" & @CRLF $sSource &= "/* Cube faces colors */" & @CRLF $sSource &= ".cube__face--front { background: hsla( 0, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--right { background: hsla( 60, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--back { background: hsla(120, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--left { background: hsla(180, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--top { background: hsla(240, 100%, 50%, 0.7); }" & @CRLF $sSource &= ".cube__face--bottom { background: hsla(300, 100%, 50%, 0.7); }" & @CRLF $sSource &= "" & @CRLF $sSource &= ".cube__face--front { transform: rotateY( 0deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--right { transform: rotateY( 90deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--back { transform: rotateY(180deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--left { transform: rotateY(-90deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--top { transform: rotateX( 90deg) translateZ(100px); }" & @CRLF $sSource &= ".cube__face--bottom { transform: rotateX(-90deg) translateZ(100px); }" & @CRLF $sSource &= "" & @CRLF $sSource &= "/* --------------------------------------------------------------------------- */" & @CRLF $sSource &= "/* https://beamtic.com/rotating-radial-stripes-css */" & @CRLF $sSource &= "#body_stripes_container .radial_stripes {" & @CRLF $sSource &= " position:absolute; /* absolute; */" & @CRLF $sSource &= " margin:-100px 0 0 25px; /* auto; */" & @CRLF $sSource &= " left:0;" & @CRLF $sSource &= " top:0;" & @CRLF $sSource &= " width:100vw;" & @CRLF $sSource &= " height:100vw;" & @CRLF $sSource &= " opacity:1;" & @CRLF $sSource &= " animation:rotate 60s infinite linear;" & @CRLF $sSource &= "}" & @CRLF $sSource &= ".radial_stripes {background-image: url(""data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 1003.97 1009.5'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill-rule:evenodd;fill:url(%23radial-gradient);%7D%3C/style%3E%3CradialGradient id='radial-gradient' cx='615.23' cy='557.75' r='503.37' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-opacity='0.5'/%3E%3Cstop offset='1' stop-color='%23333' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ctitle%3Eradial-stripes%3C/title%3E%3Cpath class='cls-1' d='M615.23,53V557.75L510.29,64ZM318.54,149.4,615.23,557.75,409.93,96.64Zm-140.44,156L615.23,557.75,240.13,220ZM113.24,505l502,52.76-480-156Zm21.94,208.74,480.05-156-502,52.76Zm105,181.76,375.1-337.74L178.1,810.13Zm169.8,123.37,205.3-461.11L318.54,966.1Zm205.3,43.64V557.75L510.29,1051.47Zm205.3-43.64L615.23,557.75l104.94,493.72Zm169.8-123.37L615.23,557.75,911.91,966.1Zm104.94-181.76-480-156,437.13,252.38ZM1117.21,505l-502,52.76,502,52.76Zm-64.85-199.62L615.23,557.75l480-156Zm-140.45-156L615.23,557.75,990.33,220ZM720.17,64,615.23,557.75,820.53,96.64Z' transform='translate(-113.24 -53)'/%3E%3C/svg%3E"");}" & @CRLF $sSource &= "" & @CRLF $sSource &= "/* Animations */" & @CRLF $sSource &= "@keyframes rotate {" & @CRLF $sSource &= " from {transform:rotate(0deg);}" & @CRLF $sSource &= " to {transform:rotate(360deg);}" & @CRLF $sSource &= "}" & @CRLF $sSource &= "/* --------------------------------------------------------------------------- */" & @CRLF $sSource &= "/* Author: w3schools.in" & @CRLF $sSource &= "URL: https://www.w3schools.in/css/examples/infinite-scrolling-text" & @CRLF $sSource &= "license: Free to use without republishing." & @CRLF $sSource &= "https://www.w3schools.in/page/copyright */" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Container styles */" & @CRLF $sSource &= " .scrolling-text-container {" & @CRLF $sSource &= " border-radius: 4px;" & @CRLF $sSource &= " overflow: hidden;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Inner container styles */" & @CRLF $sSource &= " .scrolling-text-inner {" & @CRLF $sSource &= " display: flex;" & @CRLF $sSource &= " white-space: pre;" & @CRLF $sSource &= " font-size: 32px;" & @CRLF $sSource &= " font-weight: 600;" & @CRLF $sSource &= " padding: 8px 0;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Text styles */" & @CRLF $sSource &= " .scrolling-text {" & @CRLF $sSource &= " display: flex;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " .scrolling-text-item {" & @CRLF $sSource &= " padding: 0 30px;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Apply the animation to the text items */" & @CRLF $sSource &= " .scrolling-text-inner > div {" & @CRLF $sSource &= " animation: var(--direction) var(--marquee-speed) linear infinite;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Pause the animation when a user hovers over it */" & @CRLF $sSource &= " .scrolling-text-container:hover .scrolling-text-inner > div {" & @CRLF $sSource &= " animation-play-state: paused;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " /* Setting the Animation using Keyframes */" & @CRLF $sSource &= " @keyframes scroll-left {" & @CRLF $sSource &= " 0% {" & @CRLF $sSource &= " transform: translateX(0%);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " 100% {" & @CRLF $sSource &= " transform: translateX(-100%);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " }" & @CRLF $sSource &= "/* color */" & @CRLF $sSource &= "/* https://stackoverflow.com/questions/25507496/css-change-text-color-randomly */" & @CRLF $sSource &= " h1 {" & @CRLF $sSource &= " background-image: -webkit-linear-gradient(92deg,#f35626,#feab3a);" & @CRLF $sSource &= " -webkit-background-clip: text;" & @CRLF $sSource &= " -webkit-text-fill-color: transparent;" & @CRLF $sSource &= " -webkit-animation: hue 6s infinite linear;" & @CRLF $sSource &= " }" & @CRLF $sSource &= "" & @CRLF $sSource &= " @-webkit-keyframes hue {" & @CRLF $sSource &= " from {" & @CRLF $sSource &= " -webkit-filter: hue-rotate(0deg);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " to {" & @CRLF $sSource &= " -webkit-filter: hue-rotate(360deg);" & @CRLF $sSource &= " }" & @CRLF $sSource &= " }" & @CRLF $sSource &= "/* ----- */" & @CRLF $sSource &= "</style>" & @CRLF $sSource &= "</head>" & @CRLF $sSource &= "<body class=""page--intro"">" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "<div id=""body_stripes_container"">" & @CRLF $sSource &= "<div class=""radial_stripes""></div>" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "" & @CRLF $sSource &= "<div class=""scene scene--hero"">" & @CRLF $sSource &= "<div class=""cube cube--hero is-spinning"">" & @CRLF $sSource &= "<div class=""cube__face cube__face--front""><iframe width=""100%"" height=""100%"" src=""https://www.youtube.com/embed/sEMiWoRRixY?autoplay=1&amp;loop=1&amp;modestbranding=1&amp;controls=0&amp;showinfo=0&amp;rel=0&amp;playlist=sEMiWoRRixY"" allow=""autoplay"" frameborder=""0""></iframe></div>" & @CRLF ; &#x2764&#xFE0F</div> <!-- red heart -->" & @CRLF $sSource &= "<!-- <div class=""cube__face cube__face--front""><img src=""https://www.autoitscript.com/forum/cdn/images/logo_autoit_210x72.svg"" alt=""☺""></div> --> <!-- AutoIt logo -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--right"">&#x1F91F</div> <!-- love-you gesture -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--back"">&#x1F54A&#xFE0F</div> <!-- dove of peace -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--left"">&#x1F3F3&#xFE0F&#x200D&#x1F308</div> <!-- peace flag -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--top"">&#x2696&#xFE0F</div> <!-- balance of justice -->" & @CRLF $sSource &= "<div class=""cube__face cube__face--bottom"">&#x262E&#xFE0E</div> <!-- peace sign -->" & @CRLF $sSource &= "<!-- <div class=""cube__face cube__face--bottom""><img src=""https://www.autoitscript.com/forum/uploads/monthly_2022_02/Gianni.jpg.eb7f87bf14dac954de68a882e057e0d5.jpg"" alt=""☺""></div> --> <!-- Gianni -->" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "<!-- Marquee -->" & @CRLF $sSource &= "<div class=""scrolling-text-container"">" & @CRLF $sSource &= " <div class=""scrolling-text-inner"" style=""--marquee-speed: 120s; --direction:scroll-left"" role=""marquee"">" & @CRLF $sSource &= " <div class=""scrolling-text"">" & @CRLF $sSource &= " <div class=""scrolling-text-item""> </div>" & @CRLF $sSource &= " <div class=""scrolling-text-item""><h1>" & $sPeace & "</h1></div>" & @CRLF $sSource &= " </div>" & @CRLF $sSource &= " </div>" & @CRLF $sSource &= "</div>" & @CRLF $sSource &= "<!-- --------------------------------- -->" & @CRLF $sSource &= "</body>" & @CRLF $sSource &= "</html>" & @CRLF Return $sSource EndFunc ;==>_GetSource Func _Done() TCPShutdown() ConsoleWrite(" << Done >>" & @CRLF) EndFunc ;==>TheEnd
  13. just for fun, here's an alternative 'shortened' version ; https://www.autoitscript.com/forum/topic/211237-treestructuredir ;---------------------------------------------------------------------------------------- ; Title...........: TreeStructureDir.au3 ; Description.....: Structure of a folder in text, with tree format for a more visually improved format ; AutoIt Version..: 3.3.16.1 Author: ioa747 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 Global $sPath = "C:\Program Files (x86)\AutoIt3" Global $sTxt = TreeStructureDir($sPath) ConsoleWrite($sPath & @CRLF & $sTxt & @CRLF) ;---------------------------------------------------------------------------------------- Func TreeStructureDir($sDirectoryPath) Local $sTree = '', $iPID = Run(@ComSpec & ' /c tree "' & $sDirectoryPath & '" /A', '', @SW_HIDE, 8) While ProcessExists($iPID) $sTree &= StdoutRead($iPID) WEnd Return $sTree EndFunc ;==>TreeStructureDir ;----------------------------------------------------------------------------------------
×
×
  • Create New...