saraconor Posted August 7, 2019 Share Posted August 7, 2019 #AutoIt3Wrapper_Res_File_Add=1.gif, rt_rcdata, G2 #include "resources.au3" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GIFAnimation.au3" $sFile = @ScriptDir & "\1.gif" $hGui = GUICreate("GIF Animation", 411, 211, -1, -1) $hGIF = _GUICtrlCreateGIF($sFile, "", 61, 10) GUISetState() do until GUIGetMsg() = -3 How to use GIF in compiled script with Wpapper? GIFAnimation.au3 resources.au3 Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 Just now, saraconor said: #AutoIt3Wrapper_Res_File_Add=1.gif, rt_rcdata, G2 #include "resources.au3" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GIFAnimation.au3" $sFile = @ScriptDir & "\1.gif" $hGui = GUICreate("GIF Animation", 411, 211, -1, -1) $hGIF = _GUICtrlCreateGIF($sFile, "", 61, 10) GUISetState() do until GUIGetMsg() = -3 How to use GIF in compiled script with Wpapper? GIF.rar Link to comment Share on other sites More sharing options...
Nine Posted August 7, 2019 Share Posted August 7, 2019 Get RessourceEX UDF and look at the example file, it is very simple to configure it : “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 21 minutes ago, Nine said: Get RessourceEX UDF and look at the example file, it is very simple to configure it : #AutoIt3Wrapper_Res_File_Add=1.gif, rt_rcdata, G2 #include "resources.au3" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GIFAnimation.au3" #include "ResourcesEx.au3" $hGui = GUICreate("GIF Animation", 411, 211, -1, -1) $iPic = GUICtrlCreatePic('', 61, 10, 61, 10) if Not @Compiled Then _GUICtrlCreateGIF(@ScriptDir & "\1.gif", "", 61, 10) _Resource_SetToCtrlID($iPic, 'G2') GUISetState() do until GUIGetMsg() = -3 #AutoIt3Wrapper_Res_File_Add=1.gif, rt_rcdata, G2 #include "resources.au3" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GIFAnimation.au3" #include "ResourcesEx.au3" $hGui = GUICreate("GIF Animation", 411, 211, -1, -1) $iPic = GUICtrlCreatePic('', 61, 10, 61, 10) if Not @Compiled Then _GUICtrlCreateGIF(@ScriptDir & "\1.gif", "", 61, 10) _Resource_SetToCtrlID($iPic, 'G2') GUISetState() do until GUIGetMsg() = -3 I lost, maximum what i get is static image, without animation Link to comment Share on other sites More sharing options...
Zedna Posted August 7, 2019 Share Posted August 7, 2019 In my Resources UDF (link is in my signature) there is also example for animated GIFs. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 4 minutes ago, Zedna said: In my Resources UDF (link is in my signature) there is also example for animated GIFs. I saw these topics too, but could not understand. Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 Please help. Link to comment Share on other sites More sharing options...
Zedna Posted August 7, 2019 Share Posted August 7, 2019 (edited) Here is my example from my UDF (resource_test_ani_gif.au3 ) expandcollapse popup#AutoIt3Wrapper_Res_File_Add=gif-Green-UFO.gif, rt_rcdata, ANI_GIF_1 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <WinAPI.au3> #include <Timers.au3> #include "resources.au3" HotKeySet("{Esc}", "Quit") HotKeySet("{Left}", "Left") HotKeySet("{Right}", "Right") HotKeySet("{Pause}", "Pause") Global $GIF_TimerID, $hImage, $IMG_Ctrl, $GFC, $GFDC, $pDimensionIDs, $tDL Global $Pause, $i = 0 $hGUI = GUICreate("GIF Animation", 300, 200) GUICtrlCreateLabel("text behind GIF - test of transparency", 5, 15, 200, 25) $IMG_Ctrl = GUICtrlCreateLabel("", 10, 10, 10, 10) ; For Drawing GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; Transparency's working GUISetState(@SW_SHOW) GifInit() ; Start Animation: instead of using the time delays between frames given from GIF we use 100ms for simplicity _Timer_SetTimer($hGUI, 100, "_Draw_Timer") While 1 If GUIGetMsg() = -3 Then Quit() WEnd Func _Draw_Timer($hWnd, $Msg, $iIDTimer, $dwTime) If Not $Pause Then If $i = $GFC Then $i = 0 ; If $i = the frame count then reset $i to 0 GifDrawFrame($i) $i += 1 EndIf EndFunc Func Quit() _Timer_KillAllTimers($hGUI) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() HotKeySet("{Esc}") HotKeySet("{Left}") HotKeySet("{Right}") HotKeySet("{Pause}") Exit EndFunc Func GifInit() _GDIPlus_Startup() ; Load your animated GIF (from file or from resources) ;~ $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\gif-Green-UFO.gif") $hImage = _ResourceGetAsImage("ANI_GIF_1") $tDL = DllStructCreate($tagGUID) ; Create a struct to hold the GUID. $pDimensionIDs = DllStructGetPtr($tDL) ; Get a pointer to the GUID struct. ; Get the FrameDimensionsCount of the loaded gif $GFDC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsCount", "ptr", $hImage, "int*", 0) ; Get the FrameDimensionsList , which fills the GUID struct by passing the GUID pointer and the FrameDimensionsCount. DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsList", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $GFDC[2]) ; Get the FrameCount of the loaded gif by passing the GUID pointer $GFC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameCount", "int", $hImage, "ptr", $pDimensionIDs, "int*", 0) $GFC = $GFC[3] EndFunc Func GifDrawFrame($i) ; Select the ActiveFrame in the loaded GIF by telling it. The frame starts at 0 ($i) DllCall($ghGDIPDll, "int", "GdipImageSelectActiveFrame", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $i) ; get current frame from GIF and draw it on the control $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _SetBitmapToCtrl($IMG_Ctrl, $hBitmap) _WinAPI_DeleteObject($hBitmap) EndFunc Func Left() If WinActive($hGUI) Then If Not $Pause Then Return $i -= 1 If $i = -1 Then $i = $GFC - 1 GifDrawFrame($i) Else HotKeySet("{Left}") Send("{Left}") HotKeySet("{Left}", "Left") EndIf EndFunc Func Right() If WinActive($hGUI) Then If Not $Pause Then Return $i += 1 If $i = $GFC Then $i = 0 GifDrawFrame($i) Else HotKeySet("{Right}") Send("{Right}") HotKeySet("{Right}", "Right") EndIf EndFunc Func Pause() If WinActive($hGUI) Then $Pause = Not $Pause If $Pause Then WinSetTitle($hGUI, '', 'GIF Animation - PAUSED') Else WinSetTitle($hGUI, '', 'GIF Animation') EndIf Else HotKeySet("{PAUSE}") Send("{PAUSE}") HotKeySet("{PAUSE}", "Pause") EndIf EndFunc Edited August 7, 2019 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted August 7, 2019 Share Posted August 7, 2019 (edited) And here is simplified version without Pause/Left/Right hotkeys, just automatically indefinitelly plays GIF image: expandcollapse popup#AutoIt3Wrapper_Res_File_Add=gif-Green-UFO.gif, rt_rcdata, ANI_GIF_1 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <WinAPI.au3> #include <Timers.au3> #include "resources.au3" HotKeySet("{Esc}", "Quit") Global $GIF_TimerID, $hImage, $IMG_Ctrl, $GFC, $GFDC, $pDimensionIDs, $tDL Global $i = 0 $hGUI = GUICreate("GIF Animation", 300, 200) GUICtrlCreateLabel("text behind GIF - test of transparency", 5, 15, 200, 25) $IMG_Ctrl = GUICtrlCreateLabel("", 10, 10, 10, 10) ; For Drawing GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; Transparency's working GUISetState(@SW_SHOW) GifInit() ; Start Animation: instead of using the time delays between frames given from GIF we use 100ms for simplicity _Timer_SetTimer($hGUI, 100, "_Draw_Timer") While 1 If GUIGetMsg() = -3 Then Quit() WEnd Func _Draw_Timer($hWnd, $Msg, $iIDTimer, $dwTime) If $i = $GFC Then $i = 0 ; If $i = the frame count then reset $i to 0 GifDrawFrame($i) $i += 1 EndFunc Func Quit() _Timer_KillAllTimers($hGUI) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() HotKeySet("{Esc}") Exit EndFunc Func GifInit() _GDIPlus_Startup() ; Load your animated GIF (from file or from resources) ;~ $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\gif-Green-UFO.gif") $hImage = _ResourceGetAsImage("ANI_GIF_1") $tDL = DllStructCreate($tagGUID) ; Create a struct to hold the GUID. $pDimensionIDs = DllStructGetPtr($tDL) ; Get a pointer to the GUID struct. ; Get the FrameDimensionsCount of the loaded gif $GFDC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsCount", "ptr", $hImage, "int*", 0) ; Get the FrameDimensionsList , which fills the GUID struct by passing the GUID pointer and the FrameDimensionsCount. DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsList", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $GFDC[2]) ; Get the FrameCount of the loaded gif by passing the GUID pointer $GFC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameCount", "int", $hImage, "ptr", $pDimensionIDs, "int*", 0) $GFC = $GFC[3] EndFunc Func GifDrawFrame($i) ; Select the ActiveFrame in the loaded GIF by telling it. The frame starts at 0 ($i) DllCall($ghGDIPDll, "int", "GdipImageSelectActiveFrame", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $i) ; get current frame from GIF and draw it on the control $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _SetBitmapToCtrl($IMG_Ctrl, $hBitmap) _WinAPI_DeleteObject($hBitmap) EndFunc EDIT: Note that my Resources UDF and these examples are compatible with old AutoIt 3.2.12.1 which is still my mainly used one version. Edited August 7, 2019 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 There is errors: warning: $ghGDIPDll: possibly used before declaration. error: $ghGDIPDll: undeclared global variable. Link to comment Share on other sites More sharing options...
Zedna Posted August 7, 2019 Share Posted August 7, 2019 Read again WHOLE my last post!! Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 Then, when i declare it as global error appear "DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsList", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $GFDC[2])" is there has easiest example for this? Link to comment Share on other sites More sharing options...
Zedna Posted August 7, 2019 Share Posted August 7, 2019 Try to look at ResourcesEx UDF which is based of my Resources but compatible with latest AutoIt: Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 1 minute ago, Zedna said: Try to look at ResourcesEx UDF which is based of my Resources but compatible with latest AutoIt: Already tried, does not start because of an error (i hawe autoit v3.3.14.5) Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 _WinAPI_SetWindowLong(): undefined function Link to comment Share on other sites More sharing options...
Zedna Posted August 7, 2019 Share Posted August 7, 2019 Try to look if author of ResourcesEx have (similar or converted) example for animated GIFs in his package. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 There is only one example in package, and it hawe error. I look other examples on forum but could not find anything useful ( Link to comment Share on other sites More sharing options...
Developers Jos Posted August 7, 2019 Developers Share Posted August 7, 2019 @saraconor, Care to slow down a little and simply focus on one example script? Just report which one you are using, post the script and the encountered error. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
saraconor Posted August 7, 2019 Author Share Posted August 7, 2019 3 minutes ago, Jos said: @saraconor, Care to slow down a little and simply focus on one example script? Just report which one you are using, post the script and the encountered error. Jos I use Example.au3 from ResourcesEx \ Examples package, When start show: error: _WinAPI_SetWindowLong(): undefined function. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 7, 2019 Developers Share Posted August 7, 2019 (edited) So what does that tell you? I did the same and indeed get that error for _WinAPI_SetWindowLong(), so simply opened the AutoIt3 helpfile and look for _WinAPI_SetWindowLong(), which tells me I need to have this include in the source: #include <WinAPISysWin.au3> ..so added that at the top in example.au3 and didn't get an error anymore. Jos Edited August 7, 2019 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now