Leaderboard
Popular Content
Showing content with the highest reputation on 11/02/2013 in all areas
-
mesale0077 asked me whether I could code some CSS loading animations from different web sites. These are the results using GDI+ (AutoIt v3.3.12.0+ required!): _GDIPlus_MonochromaticBlinker.au3 / _GDIPlus_RotatingBokeh.au3 _GDIPlus_SpinningCandy.au3 / _GDIPlus_SteamPunkLoading.au3 _GDIPlus_IncreasingBalls.au3 / _GDIPlus_PacmanProgressbar.au3 _GDIPlus_StripProgressbar.au3 / _GDIPlus_RingProgressbar.au3 _GDIPlus_LineProgressbar.au3 / _GDIPlus_SimpleLoadingAnim.au3 _GDIPlus_TextFillingWithWater.au3 / _GDIPlus_MultiColorLoader.au3 _GDIPlus_LoadingSpinner.au3 / _GDIPlus_SpinningAndPulsing.au3 _GDIPlus_TogglingSphere.au3 / _GDIPlus_CloudySpiral.au3 _GDIPlus_GlowingText.au3 (thanks to Eukalyptus) / _GDIPlus_HypnoticLoader.au3 _GDIPlus_RotatingRectangles.au3 / _GDIPlus_TRONSpinner.au3 _GDIPlus_RotatingBars.au3 / _GDIPlus_AnotherText.au3 (thanks to Eukalyptus) _GDIPlus_CogWheels.au3 (thanks to Eukalyptus) / _GDIPlus_DrawingText.au3 (thanks to Eukalyptus) _GDIPlus_GearsAnim.au3 / _GDIPlus_LEDAnim.au3 _GDIPlus_LoadingTextAnim.au3 / _GDIPlus_MovingRectangles.au3 _GDIPlus_SpinningAndGlowing.au3 (thanks to Eukalyptus) / _GDIPlus_YetAnotherLoadingAnim.au3 _GDIPlus_AnimatedTypeLoader.au3 / _GDIPlus_Carousel.au3 Each animation function has a built-in example how it can be used. AiO download: GDI+ Animated Wait Loading Screens.7z (previous downloads: 1757) Big thanks to Eukalyptus for providing several examples. Maybe useful for some of you Br, UEZ PS: I don't understand CSS - everything is made out of my mind, so it might be different from original CSS examples1 point
-
After UEZ helped me with the Countdown Timer his techniques seemed perfect for displaying individual images with transparency. One thing led to another and here's the resulting script. Download the attached zip file and place the 5 PNG files in the same folder as this script. I did not embed the images in the script, to make the script easier to read and so you can see the actual images used. In my opinion the ultimate next step would be to add the ability to play animated GIFs, still with transparency if that's possible. Enjoy! (with much gratitude to UEZ for his help) ; Functions coded by UEZ 2013-10-29 ; Updated to address issues 2013-10-31 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #NoTrayIcon _GDIPlus_Startup() ;initiate GDI+ #region ; timmy2's simple demonstration of UEZ's code ; ; display blank chalkboard (there will be no fade-in so use default $iAlpha value of 255) $aRes1 = DisplayImage( "Wood-framed-chalkboard.png", -1, -1 ) Sleep (500) ; add first two steps $aRes2 = DisplayImage("step-1.png", -1, -1 ) Sleep(2000) $aRes3 = DisplayImage("step-2.png", -1, -1 ) ; fade in handdrawn circle (therefore start with $iAlpha = 0) $aPos = WinGetPos($aRes1[0]) ;required because the chalkboard is displayed at screen center, which varies based on resolution (doh!) $aRes4 = DisplayImage("circle.png", $aPos[0] + 290, $aPos[1] + 75, 0) sleep (500) _Fader($aRes4) sleep(1000) _Fader($aRes4, False) ReleaseResources($aRes4) sleep(500) ; add third step $aRes5 = DisplayImage("step-3.png", -1, -1 ) Sleep(2000) ; fade the three steps out in reverse order (faster than defaults) _Fader($aRes5, False, 255, 5, 5) ReleaseResources($aRes5) _Fader($aRes3, False, 255, 5, 5) ReleaseResources($aRes3) _Fader($aRes2, False, 255, 5, 5) ReleaseResources($aRes2) Sleep(500) ; fade out chockboard _Fader($aRes1, False, 255, 10, 5) ReleaseResources($aRes1) #endregion _GDIPlus_Shutdown() Exit ; Display the image at center unless otherwise specified. If Fader will not be used then $iAlpha's default of 0xFF is good. ; If Fader will be used then start with $iAlpha equal to zero. Option to make this image "Always on top" is also available. Func DisplayImage($sFile, $iPosX = -1, $iPosY = -1, $iAlpha = 0xFF, $bTopmost = True) Local Const $hBmp_Background = _GDIPlus_BitmapCreateFromFile($sFile) ;load the image If @error Then Return SetError(1, 0, 0) ;image cannot be loaded Local Const $iW = _GDIPlus_ImageGetWidth($hBmp_Background), $iH = _GDIPlus_ImageGetHeight($hBmp_Background) ;get the dimension of the background image Local Const $hGUI = GUICreate("", $iW, $iH, $iPosX, $iPosY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST * $bTopmost, $WS_EX_TOOLWINDOW)) ;create GUI with appropriate styles and extented style (borderless transparent GUI) GUICtrlCreateLabel("", 0, 0, $iW, $iH, Default, $GUI_WS_EX_PARENTDRAG) ;create a hidden label for GUI dragging GUISetState(@SW_SHOW, $hGUI) ;show GUI Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) ;define an empty bitmap where all the gfx stuff will copied to Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;get the context to the bitmap to be able to copy / draw to the bitmap _GDIPlus_GraphicsDrawImageRect($hGfx, $hBmp_Background, 0, 0, $iW, $iH) ;draw background image to the empty bitmap ;display GDI+ with transparency on desktop Local Const $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) ;convert GDI+ image to GDI to display it on the screen using GDI functions Local Const $hScrDC = _WinAPI_GetDC($hGUI) ;get the device context (dc) handle of the GUI Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) ;create a compatible dc handle Local Const $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) ;selects the GDI bitmap object into the specified device context Local Const $tSize = DllStructCreate($tagSIZE) ;create a $tagSIZE struct (x = width, y = height) DllStructSetData($tSize, "X", $iW) ;set data for width DllStructSetData($tSize, "Y", $iH) ;set data for height Local $tSource = DllStructCreate($tagPOINT) ;create a $tagPOINT struct (x = x position, y = y position) Local $tBlend = DllStructCreate($tagBLENDFUNCTION) ;create $tagBLENDFUNCTION struct -> see help file for more info DllStructSetData($tBlend, "Alpha", $iAlpha) ;set the alpha channel of the GUI -> 255 = opaque, 0 = transparent DllStructSetData($tBlend, "Format", 1) ;set the format to 1 -> bitmap has alpha channels DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hGUI, "handle", $hScrDC, "ptr", 0, "struct*", $tSize, "handle", $hMemDC, "struct*", $tSource, "dword", 0, "struct*", $tBlend, "dword", $ULW_ALPHA) ;display bitmap on screen ;release resources otherwise memory will filled up (memory leak) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBitmap) Local $aResource[7] = [$hGUI, $hScrDC, $hHBitmap, $hMemDC, $tBlend, $tSize, $tSource] ;return the handle to release it later Return $aResource EndFunc ;==>DisplayImage ; This function releases the resources of a specific image and closes it Func ReleaseResources(ByRef $aResource) If Not IsArray($aResource) Then Return SetError(1, 0, 0) If UBound($aResource) <> 7 Then Return SetError(2, 0, 0) _WinAPI_ReleaseDC($aResource[0], $aResource[1]) _WinAPI_DeleteDC($aResource[3]) _WinAPI_DeleteObject($aResource[2]) GUIDelete($aResource[0]) EndFunc ;==>ReleaseResources ; To fade in an image leave $bIn at default (True); to fade out specify False. ; There are also options to set the ending transparency level (0 transparent, 255 opaque), speed and delay. ; If you change the speed or delay be sure to specify $bIn and $iTrans, otherwise you'll wonder why the fade-in or out isn't what you hoped for. ; The default values are specified in the function below. Func _Fader($res1, $bIn = True, $iTrans = 255, $speed = 3, $delay = 10 ) If Not IsArray($res1) Then Return SetError(1, 0, 0) If UBound($res1) <> 7 Then Return SetError(2, 0, 0) Switch $bIn Case True For $a = 0 To $iTrans Step $speed DllStructSetData($res1[4], "Alpha", $a) DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $res1[0], "handle", $res1[1], "ptr", 0, "struct*", $res1[5], "handle", $res1[3], "struct*", $res1[6], "dword", 0, "struct*", $res1[4], "dword", $ULW_ALPHA) ;display bitmap on screen Sleep($delay) Next Case Else For $a = $iTrans To 0 Step -$speed DllStructSetData($res1[4], "Alpha", $a) DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $res1[0], "handle", $res1[1], "ptr", 0, "struct*", $res1[5], "handle", $res1[3], "struct*", $res1[6], "dword", 0, "struct*", $res1[4], "dword", $ULW_ALPHA) ;display bitmap on screen Sleep($delay) Next EndSwitch EndFunc ;==>_FadeIn #region GDI and GDI+ functions Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iPixelFormat = $GDIP_PXF32ARGB, $iStride = 0, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return $aResult[6] EndFunc ;==>_GDIPlus_BitmapCreateFromScan0 #endregion GDI and GDI+ functions images.zip1 point
-
He was using the two step verification which requires the generation for a special password. Read up on Gmail 2 step authentication when you want to know the specifics but this is a nice way to avoid being hacked. Jos1 point
-
JohnOne, As is now the case. M231 point
-
Smooth display of PNGs with transparency, fade-in/out and AOT
mesale0077 reacted to UEZ for a topic
Here more information about the returned array: Local $aResource[7] = [$hGUI, _ ;GUI handle $hScrDC, _ ;device context (dc) handle of the GUI (GDI) $hHBitmap, _ ;GDI bitmap handle of the displayed image $hMemDC, _ ;compatible dc handle from $hScrDC $tBlend, _ ;tBlend struct (source blend oper., flags, alpha value, format) -> see help file for description $tSize, _ ;tSize struct (width and height of the window / image) $tSource] ;tSource struct for x / y position of the GUI Return $aResource ;returns the handles to release it later or to use it for fading effects Here the complete code: ; Functions coded by UEZ 2013-11-02 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #NoTrayIcon _GDIPlus_Startup() ;initiate GDI+ #region ; timmy2's simple demonstration of UEZ's code ; ; display blank chalkboard (there will be no fade-in so use default $iAlpha value of 255) $aRes1 = DisplayImage( "Wood-framed-chalkboard.png", -1, -1 ) If @error Then ConsoleWrite( "Error " & @error & " has occured." & @LF ) _GDIPlus_Shutdown() Exit EndIf Sleep (500) ; add first two steps $aRes2 = DisplayImage("step-1.png", -1, -1 ) Sleep(2000) $aRes3 = DisplayImage("step-2.png", -1, -1 ) ; fade in handdrawn circle (therefore start with $iAlpha = 0) $aPos = WinGetPos($aRes1[0]) $aRes4 = DisplayImage("circle.png", $aPos[0] + 290, $aPos[1] + 75, 0) sleep (500) _Fader($aRes4) sleep(1000) _Fader($aRes4, False) ReleaseResources($aRes4) sleep(500) ; add third step $aRes5 = DisplayImage("step-3.png", -1, -1 ) Sleep(2000) ; fade the three steps out in reverse order (faster than defaults) _Fader($aRes5, False, 255, 5, 5) ReleaseResources($aRes5) _Fader($aRes3, False, 255, 5, 5) ReleaseResources($aRes3) _Fader($aRes2, False, 255, 5, 5) ReleaseResources($aRes2) Sleep(500) ; fade out chockboard _Fader($aRes1, False, 255, 10, 5) ReleaseResources($aRes1) #endregion _GDIPlus_Shutdown() Exit ; Display the image at center unless otherwise specified. If Fader will not be used then $iAlpha's default of 0xFF is good. ; If Fader will be used then start with $iAlpha equal to zero. Option to make this image "Always on top" is also available. Func DisplayImage($sFile, $iPosX = -1, $iPosY = -1, $iAlpha = 0xFF, $bTopmost = True) Local Const $hBmp_Background = _GDIPlus_BitmapCreateFromFile($sFile) ;load the image If @error Then Return SetError(1, 0, 0) ;image cannot be loaded Local Const $iW = _GDIPlus_ImageGetWidth($hBmp_Background), $iH = _GDIPlus_ImageGetHeight($hBmp_Background) ;get the dimension of the background image Local Const $hGUI = GUICreate("", $iW, $iH, $iPosX, $iPosY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST * $bTopmost, $WS_EX_TOOLWINDOW)) ;create GUI with appropriate styles and extented style (borderless transparent GUI) GUICtrlCreateLabel("", 0, 0, $iW, $iH, Default, $GUI_WS_EX_PARENTDRAG) ;create a hidden label for GUI dragging GUISetState(@SW_SHOW, $hGUI) ;show GUI Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) ;define an empty bitmap where all the gfx stuff will copied to Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;get the context to the bitmap to be able to copy / draw to the bitmap _GDIPlus_GraphicsDrawImageRect($hGfx, $hBmp_Background, 0, 0, $iW, $iH) ;draw background image to the empty bitmap ;display GDI+ with transparency on desktop Local Const $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) ;convert GDI+ image to GDI to display it on the screen using GDI functions Local Const $hScrDC = _WinAPI_GetDC($hGUI) ;get the device context (dc) handle of the GUI Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) ;create a compatible dc handle Local Const $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) ;selects the GDI bitmap object into the specified device context Local Const $tSize = DllStructCreate($tagSIZE) ;create a $tagSIZE struct (x = width, y = height) DllStructSetData($tSize, "X", $iW) ;set data for width DllStructSetData($tSize, "Y", $iH) ;set data for height Local $tSource = DllStructCreate($tagPOINT) ;create a $tagPOINT struct (x = x position, y = y position) Local $tBlend = DllStructCreate($tagBLENDFUNCTION) ;create $tagBLENDFUNCTION struct -> see help file for more info DllStructSetData($tBlend, "Alpha", $iAlpha) ;set the alpha channel of the GUI -> 255 = opaque, 0 = transparent DllStructSetData($tBlend, "Format", 1) ;set the format to 1 -> bitmap has alpha channels DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hGUI, "handle", $hScrDC, "ptr", 0, "struct*", $tSize, "handle", $hMemDC, "struct*", $tSource, "dword", 0, "struct*", $tBlend, "dword", $ULW_ALPHA) ;display bitmap on screen ;release resources otherwise memory will filled up (memory leak) _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_BitmapDispose($hBitmap) Local $aResource[7] = [$hGUI, _ ;GUI handle $hScrDC, _ ;device context (dc) handle of the GUI (GDI) $hHBitmap, _ ;GDI bitmap handle of the displayed image $hMemDC, _ ;compatible dc handle from $hScrDC $tBlend, _ ;tBlend struct (source blend oper., flags, alpha value, format) -> see help file for description $tSize, _ ;tSize struct (width and height of the window / image) $tSource] ;tSource struct for x / y position of the GUI Return $aResource ;returns the handles to release it later or to use it for fading effects EndFunc ;==>DisplayImage ; This function releases the resources of a specific image and closes it Func ReleaseResources(ByRef $aResource) If Not IsArray($aResource) Then Return SetError(1, 0, 0) If UBound($aResource) <> 7 Then Return SetError(2, 0, 0) _WinAPI_ReleaseDC($aResource[0], $aResource[1]) _WinAPI_DeleteDC($aResource[3]) _WinAPI_DeleteObject($aResource[2]) GUIDelete($aResource[0]) EndFunc ;==>ReleaseResources ; To fade in an image leave $bIn at default (True); to fade out specify False. ; There are also options to set the ending transparency level (0 transparent, 255 opaque), speed and delay. ; If you change the speed or delay be sure to specify $bIn and $iTrans, otherwise you'll wonder why the fade-in or out isn't what you hoped for. ; The default values are specified in the function below. Func _Fader($res1, $bIn = True, $iTrans = 255, $speed = 3, $delay = 10 ) If Not IsArray($res1) Then Return SetError(1, 0, 0) If UBound($res1) <> 7 Then Return SetError(2, 0, 0) Switch $bIn Case True For $a = 0 To $iTrans Step $speed DllStructSetData($res1[4], "Alpha", $a) DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $res1[0], "handle", $res1[1], "ptr", 0, "struct*", $res1[5], "handle", $res1[3], "struct*", $res1[6], "dword", 0, "struct*", $res1[4], "dword", $ULW_ALPHA) ;display bitmap on screen Sleep($delay) Next Case Else For $a = $iTrans To 0 Step -$speed DllStructSetData($res1[4], "Alpha", $a) DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $res1[0], "handle", $res1[1], "ptr", 0, "struct*", $res1[5], "handle", $res1[3], "struct*", $res1[6], "dword", 0, "struct*", $res1[4], "dword", $ULW_ALPHA) ;display bitmap on screen Sleep($delay) Next EndSwitch EndFunc ;==>_FadeIn #region GDI and GDI+ functions Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iPixelFormat = $GDIP_PXF32ARGB, $iStride = 0, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Return $aResult[6] EndFunc ;==>_GDIPlus_BitmapCreateFromScan0 #endregion GDI and GDI+ functions Br, UEZ1 point -
Another RegEx help needed
michaelslamet reacted to DXRW4E for a topic
StringRegExpReplace("20101006152623", "(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})", "$1-$2-$3 $4:$5:$6") Ciao.1 point -
Update the Excel UDF that comes with AutoIt
FlashpointBlack reacted to water for a topic
I will have a look. BTW: ConsoleWrite("_Excel_BookOpenText @Error: " & @Error & @CRLF) ConsoleWrite("_Excel_BookOpenText @Extended: " & @Extended & @CRLF) will always return 0 for the second line because the first ConsoleWrite resets @error and @extended1 point -
Posting your lame game bot on a site that specifically forbids discussions on game automation?1 point
-
Tried your script with my copy and got no errors. Sorry I can't remember what I had changed (if anything). _Adlib.au31 point
-
Smooth display of PNGs with transparency, fade-in/out and AOT
mesale0077 reacted to UEZ for a topic
Replace these lines and post the result: $aRes1 = DisplayImage( "Wood-framed-chalkboard.png", -1, -1 ) If @error Then Exit MsgBox(0, "", @error) Further test with $aRes1 = DisplayImage( @ScriptDir & "\Wood-framed-chalkboard.png", -1, -1 ) Be sure that the images are in the same folder as the script! Br, UEZ1 point -
Smooth display of PNGs with transparency, fade-in/out and AOT
mesale0077 reacted to UEZ for a topic
Further, due to different screen resolutions the circle is only placed properly when the screen resolution is the same as yours. Try this instead: ; fade in handdrawn circle (therefore start with $iAlpha = 0) $aPos = WinGetPos($aRes1[0]) $aRes4 = DisplayImage("circle.png", $aPos[0] + 290, $aPos[1] + 75, 0) sleep (500) _Fader($aRes4) sleep(1000) _Fader($aRes4, False) ReleaseResources($aRes4) sleep(500) ; add third step Br, UEZ1 point -
Smooth display of PNGs with transparency, fade-in/out and AOT
mesale0077 reacted to UEZ for a topic
Seems to be that an image wasn't loaded properly. Try this function and check error code please: Func _Fader($res1, $bIn = True, $iTrans = 255, $speed = 3, $delay = 10 ) If Not IsArray($res1) Then Return SetError(1, 0, 0) If UBound($res1) <> 7 Then Return SetError(2, 0, 0) Switch $bIn Case True For $a = 0 To $iTrans Step $speed DllStructSetData($res1[4], "Alpha", $a) DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $res1[0], "handle", $res1[1], "ptr", 0, "struct*", $res1[5], "handle", $res1[3], "struct*", $res1[6], "dword", 0, "struct*", $res1[4], "dword", $ULW_ALPHA) ;display bitmap on screen Sleep($delay) Next Case Else For $a = $iTrans To 0 Step -$speed DllStructSetData($res1[4], "Alpha", $a) DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $res1[0], "handle", $res1[1], "ptr", 0, "struct*", $res1[5], "handle", $res1[3], "struct*", $res1[6], "dword", 0, "struct*", $res1[4], "dword", $ULW_ALPHA) ;display bitmap on screen Sleep($delay) Next EndSwitch EndFunc ;==>_FadeIn Br,UEZ1 point -
Noticed that WinSCP, a nifty little file transfer program, now sports a COM capable module. I was wondering if anyone has played around with it and perhaps gotten some syntax examples or the startings of an au3 compatible library.1 point