wraithdu Posted June 9, 2009 Posted June 9, 2009 (edited) Yeah, that's exactly what he meant. He'll need those functions to find the files to rotate through. EDIT - And I like this UDF a lot, really great work. Edited June 9, 2009 by wraithdu
trancexx Posted June 9, 2009 Author Posted June 9, 2009 (edited) Yeah, that's exactly what he meant. He'll need those functions to find the files to rotate through.EDIT -And I like this UDF just as much as your AniGif one. Really great work. I haven't learned any assembly, so it's a bit over my head right now.Would you believe me if I tell you that I read your post as FileInstall() was there. So weird... You are right of course.edit: what AniGif? Edited June 9, 2009 by trancexx ♡♡♡ . eMyvnE
wraithdu Posted June 9, 2009 Posted June 9, 2009 (edited) Sorry, n/m, I was under some impression you had done this one. Brain fart. Edited June 9, 2009 by wraithdu
corgano Posted June 9, 2009 Posted June 9, 2009 (edited) I liked the UDF, it seems to work better than the picture viewer on any version of windowsThis is what i need (pic in link) : http://www.mediafire.com/download.php?eyegmd0vnniwhen yo click the right arrow it displays the next picture in the folder.I looked in the helpfile. Working on rough program, but I would also like to see what you come up with.UPDATEI can't get past the fact that FileFindFirstFile / FileFindNextFile serches from the script dir. How would I use it? Edited June 10, 2009 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
wraithdu Posted June 10, 2009 Posted June 10, 2009 Try including a path as the argument to FileFindFirstFile(), or set the working directory with FileChangeDir(). But the latter is dangerous if you are not positive something else won't change the working dir, like FileOpenDialog().
corgano Posted June 10, 2009 Posted June 10, 2009 Try including a path as the argument to FileFindFirstFile(), or set the working directory with FileChangeDir(). But the latter is dangerous if you are not positive something else won't change the working dir, like FileOpenDialog().I tried the first one with no luck. Could you give an example of how to use the first one? 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
wraithdu Posted June 10, 2009 Posted June 10, 2009 $hfind = FileFindFirstFile("C:\Program Files\*.*") While 1 $item = FileFindNextFile($hfind) If @error Then ExitLoop ConsoleWrite("Item: " & $item & @CRLF) WEnd FileClose($hfind)
trancexx Posted June 10, 2009 Author Posted June 10, 2009 (edited) I rewrote some parts of the GIFAnimation.au3.If you have gone through it you probably noticed the unnecessariness of some parts of the code. It looks much better now.I had to add a new byref parameter called $tFrameCurrent. On successful animation that will be structure that will hold dword with currently displayed frame. So if you want to know what frame is playing at the moment you do something like this:$iFrameCurrent = DllStructGetData($tFrameCurrent, 1)Why is this needed?Because now the control can be properly refreshed at any time (UEZ). I will update examples to demonstrate this (WM_PAINT case).Few more available functions if someone missed any, for the sake of completness.Me go update first post. edit:...and having troubles updating that first post Attachment is at the bottom. Edited June 10, 2009 by trancexx ♡♡♡ . eMyvnE
corgano Posted June 10, 2009 Posted June 10, 2009 (edited) $hfind = FileFindFirstFile("C:\Program Files\*.*") While 1 $item = FileFindNextFile($hfind) If @error Then ExitLoop ConsoleWrite("Item: " & $item & @CRLF) WEnd FileClose($hfind) Thank you, but.... I need a diferent way to do it. what if i need to find the previous file? and it is too hard to find the next file in the same folder. i am makeing a help thread for this. happy gifing Edited June 11, 2009 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
trancexx Posted June 11, 2009 Author Posted June 11, 2009 (edited) I remember few years back I watched "The Ring" movie (amer.) with this girl. It was winter and the weather was awful just making the experience more intense.She was sitting next to me (of course) and as time passed by out of fear she was almost sitting on my face. I mean she was so scared that I had to, every now and then, explain that that's only a movie, actors, director, producent, script... That was actually very helpful to me because I would be less scared too (pretending to be frightless ). That movie has some atmosphere Script with the girl from the movie(ESC to exit): check first post←expandcollapse popup#include <WindowsConstants.au3> #include "GIFAnimation.au3" Opt("GUICloseOnESC", 1); ESC to exit Opt("MustDeclareVars", 1) Global $sTempFolder = @TempDir & "\GIFS" DirCreate($sTempFolder) Global $sFile = $sTempFolder & "\TheRingGirl.gif" If Not FileExists($sFile) Then TrayTip("GIF Download", "Please wait...", 0) InetGet("http://i241.photobucket.com/albums/ff141/trancexx_bucket/TheRingGirl.gif", $sFile) TrayTip("", "", 0) EndIf Global $aGIFDimension = _GIFGetDimension($sFile) Global $hGui = GUICreate("GIF Animation", $aGIFDimension[0], $aGIFDimension[1], -1, -1, $WS_POPUP, $WS_EX_TOPMOST) Global $aGIFArrayOfIconHandles Global $hGIFThread Global $iGIFTransparent Global $tFrameCurrent Global $hGIF = _GUICtrlCreateGIF($sFile, 10, 10, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent) GUICtrlSetTip($hGIF, "I love you mommy...") GUIRegisterMsg(15, "_Refresh"); WM_PAINT GUICtrlSetPos($hGIF, 0, 0) GUISetState() While 1 Switch GUIGetMsg() Case - 3 Exit EndSwitch ConsoleWrite(DllStructGetData($tFrameCurrent, 1) & @CRLF) WEnd Func _Refresh($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _RefreshGIF($hGIF, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent) EndFunc ;==>_RefreshWhy am I writing this?- because in console you will see at any time what frame is displaying currently- it's another example with GIFAnimation.au3- you will see how that girl from the movie is scary- and will know that if you want to get close (literally) with some girl - watch horror movies together Edited August 1, 2010 by trancexx ♡♡♡ . eMyvnE
trancexx Posted June 23, 2009 Author Posted June 23, 2009 (edited) I did some code rearrangements to make things more... professional maybe.First post is with new attachment and implemented changes.Corgano/Inverted/me GIF viewer could be like this now (it's showing first frame immediately and then process gif for others): check first post ←expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GIFAnimation.au3" #include <File.au3> #include <Array.au3> Opt("MustDeclareVars", 1) Global $sFile = FileOpenDialog("Choose gif", "", "(*.gif)") If @error Then Exit Global $hGui = GUICreate("GIF Animation", 500, 500, -1, -1, $WS_OVERLAPPEDWINDOW) GUISetBkColor(0xFFFFFF) Global $aGIFDimension = _GIFGetDimension($sFile) Global $aClientSize = WinGetClientSize($hGui) Global $iPosX = ($aClientSize[0] - $aGIFDimension[0]) / 2 Global $iPosY = ($aClientSize[1] - $aGIFDimension[1]) / 2 - 100 If $iPosY < 0 Then $iPosY = 0 If $iPosY + $aGIFDimension[1] > 400 Then $iPosY -= $aGIFDimension[1] - 400; not to cover buttons Global $sDrive, $sDir, $sFName, $sExt Global $aGIFFilesArray = _FileListToArray(@WorkingDir, "*.gif", 1) Global $aSplitPath = _PathSplit($sFile, $sDrive, $sDir, $sFName, $sExt) Global $current_position = _ArraySearch($aGIFFilesArray, $aSplitPath[3] & $aSplitPath[4]) Global $aGIFArrayOfIconHandles Global $hGIFThread Global $iGIFTransparent Global $tFrameCurrent Global $hGIF = _GUICtrlCreateGIF($sFile, $iPosX, $iPosY, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent) GUICtrlSetResizing(-1, 770) Global $hButton = GUICtrlCreateButton("< Previous", 50, 450, 100, 25) GUICtrlSetResizing(-1, 836) Global $hButton1 = GUICtrlCreateButton("Stop animation", 200, 450, 100, 25) GUICtrlSetResizing(-1, 836) Global $hButton2 = GUICtrlCreateButton("Next >", 350, 450, 100, 25) GUICtrlSetResizing(-1, 836) If UBound($aGIFArrayOfIconHandles) = 1 Then GUICtrlSetData($hButton1, "Not animated") GUICtrlSetState($hButton1, $GUI_DISABLE) EndIf GUIRegisterMsg(15, "_Refresh"); WM_PAINT GUIRegisterMsg(5, "_AdjustGIFPos"); WM_SIZE GUIRegisterMsg(36, "_SetMinMax"); WM_GETMINMAXINFO Global $iPlay = 1 GUISetState() While 1 Switch GUIGetMsg() Case - 3 Exit Case $hButton GUISetCursor(15, 1) GUICtrlSetData($hButton1, "Stop animation") GUICtrlSetState($hButton, $GUI_DISABLE) GUICtrlSetState($hButton1, $GUI_DISABLE) GUICtrlSetState($hButton2, $GUI_DISABLE) _Back() GUICtrlSetState($hButton, $GUI_ENABLE) GUICtrlSetState($hButton1, $GUI_ENABLE) GUICtrlSetState($hButton2, $GUI_ENABLE) GUISetCursor(-1) $iPlay = 1 If UBound($aGIFArrayOfIconHandles) = 1 Then GUICtrlSetData($hButton1, "Not animated") GUICtrlSetState($hButton1, $GUI_DISABLE) Else GUICtrlSetState($hButton1, $GUI_ENABLE) EndIf Case $hButton1 If $iPlay Then If _StopGIFAnimation($hGIFThread) Then $iPlay = 0 GUICtrlSetData($hButton1, "Resume animation") EndIf Else If _ResumeGIFAnimation($hGIFThread) Then $iPlay = 1 GUICtrlSetData($hButton1, "Stop animation") EndIf EndIf Case $hButton2 GUISetCursor(15, 1) GUICtrlSetData($hButton1, "Stop animation") GUICtrlSetState($hButton, $GUI_DISABLE) GUICtrlSetState($hButton1, $GUI_DISABLE) GUICtrlSetState($hButton2, $GUI_DISABLE) _Forward() GUICtrlSetState($hButton, $GUI_ENABLE) GUICtrlSetState($hButton1, $GUI_ENABLE) GUICtrlSetState($hButton2, $GUI_ENABLE) GUISetCursor(-1) $iPlay = 1 If UBound($aGIFArrayOfIconHandles) = 1 Then GUICtrlSetData($hButton1, "Not animated") GUICtrlSetState($hButton1, $GUI_DISABLE) Else GUICtrlSetState($hButton1, $GUI_ENABLE) EndIf EndSwitch WEnd Func _Back() _GUICtrlDeleteGIF($hGIF, $aGIFArrayOfIconHandles, $hGIFThread, $tFrameCurrent) If $current_position > 1 Then $current_position -= 1 Else $current_position = $aGIFFilesArray[0] EndIf $aGIFDimension = _GIFGetDimension($aGIFFilesArray[$current_position]) $aClientSize = WinGetClientSize($hGui) $iPosX = ($aClientSize[0] - $aGIFDimension[0]) / 2 $iPosY = ($aClientSize[1] - $aGIFDimension[1]) / 2 - 100 If $iPosY < 0 Then $iPosY = 0 If $iPosY + $aGIFDimension[1] > $aClientSize[1] - 100 Then $iPosY -= $aGIFDimension[1] - $aClientSize[1] + 100; not to cover buttons $hGIF = _GUICtrlCreateGIF($aGIFFilesArray[$current_position], $iPosX, $iPosY, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent) EndFunc ;==>_Back Func _Forward() _GUICtrlDeleteGIF($hGIF, $aGIFArrayOfIconHandles, $hGIFThread, $tFrameCurrent) If $current_position < $aGIFFilesArray[0] Then $current_position += 1 Else $current_position = 1 EndIf $aGIFDimension = _GIFGetDimension($aGIFFilesArray[$current_position]) $aClientSize = WinGetClientSize($hGui) $iPosX = ($aClientSize[0] - $aGIFDimension[0]) / 2 $iPosY = ($aClientSize[1] - $aGIFDimension[1]) / 2 - 100 If $iPosY < 0 Then $iPosY = 0 If $iPosY + $aGIFDimension[1] > $aClientSize[1] - 100 Then $iPosY -= $aGIFDimension[1] - $aClientSize[1] + 100; not to cover buttons $hGIF = _GUICtrlCreateGIF($aGIFFilesArray[$current_position], $iPosX, $iPosY, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent) EndFunc ;==>_Forward Func _Refresh($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _RefreshGIF($hGIF, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent) EndFunc ;==>_Refresh Func _AdjustGIFPos($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $aClientSize[2] = [BitAND($lParam, 65535), BitShift($lParam, 16)] $iPosX = ($aClientSize[0] - $aGIFDimension[0]) / 2 $iPosY = ($aClientSize[1] - $aGIFDimension[1]) / 2 - 100 If $iPosY < 0 Then $iPosY = 0 If $iPosY + $aGIFDimension[1] > $aClientSize[1] - 100 Then $iPosY -= $aGIFDimension[1] - $aClientSize[1] + 100; not to cover buttons GUICtrlSetPos($hGIF, $iPosX, $iPosY, $aGIFDimension[0], $aGIFDimension[1]) EndFunc ;==>_AdjustGIFPos Func _SetMinMax($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam If $hWnd = $hGui Then Local $tMINMAXINFO = DllStructCreate("int[2];" & _ "int MaxSize[2];" & _ "int MaxPosition[2];" & _ "int MinTrackSize[2];" & _ "int MaxTrackSize[2]", _ $lParam) DllStructSetData($tMINMAXINFO, "MinTrackSize", 500, 1) DllStructSetData($tMINMAXINFO, "MinTrackSize", 350, 2) EndIf EndFunc ;==>_SetMinMax Edited August 1, 2010 by trancexx ♡♡♡ . eMyvnE
froufrou Posted June 25, 2009 Posted June 25, 2009 I know i never replied back about my problems with this.But I gave up.When I had trouble with even more scripts i finally had the answer to this problem.My Vista x64 was the problem for me.I either have to compile first or right-click the script and run as x86.So now is all good.And I really needed this one to work because i can't stand using internet explorer for .gif viewing. So great job on this.
Wooltown Posted June 29, 2009 Posted June 29, 2009 (edited) Exellent work, but I have a small problem. I am running on Windows 2000 SP4, the Animated GIF gets a flashing line moving slowly from the top to the bottom after a couple of seconds, any idea ? Edited June 29, 2009 by Wooltown
trancexx Posted June 29, 2009 Author Posted June 29, 2009 Exellent work, but I have a small problem. I am running on Windows 2000 SP4, the Animated GIF gets a flashing line moving slowly from the top to the bottom after a couple of seconds, any idea ?Yes, all the idea. There were few lines of comment in original script (I believe part of that is still found in ptrex's script that is on the first page) explaining this. It goes like this: ; Going to generate assembly code now. ; Gif could be transparent. In that case will use SendMessageW function to draw frames. ; This is flickering (or could), but I don't know better. ; If not transparent DrawIconEx is used. No flickering there. So, if the gif is transparent one that could be or is happening. ♡♡♡ . eMyvnE
Wooltown Posted June 30, 2009 Posted June 30, 2009 (edited) OK, thanks, my animsted GIF had a transparent color, I changed the code a bit Added a global variable: $iGIFTransparentOverride = 0 In _AnimateGifInAnotherThread Line 978 I changed it to If $iTransparent Or $iGIFTransparentOverride = 0 Then Now I don't see the flickering ! Perhaps the value for $iGIFTransparentOverride should be reversed Edited June 30, 2009 by Wooltown
ptrex Posted June 30, 2009 Posted June 30, 2009 @WooltownIn _AnimateGifInAnotherThread Line 978 I changed it toThere is no code in line 978 ?Regardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Wooltown Posted June 30, 2009 Posted June 30, 2009 Line 363, sorry 978 was the number of lines in the code
trancexx Posted December 23, 2009 Author Posted December 23, 2009 (edited) I posted one example on 'General help' today and I might do that there too, not to lose it.I call this "dancing on my script": check first post←expandcollapse popup#include <WindowsConstants.au3> #include <WinAPI.au3> #include "GIFAnimation.au3" Opt("GUICloseOnESC", 1); ESC to exit Opt("MustDeclareVars", 1) If @AutoItX64 Then ConsoleWriteError("! 32-bit only" & @CRLF) MsgBox(262192, "32-bit", "This is 32-bit script.") Exit EndIf Global $sTempFolder = @TempDir & "\GIFS" DirCreate($sTempFolder) Global $sFile = $sTempFolder & "\Dance.gif" If Not FileExists($sFile) Then TrayTip("GIF Download", "Please wait...", 0) InetGet("http://i241.photobucket.com/albums/ff141/trancexx_bucket/Dance.gif", $sFile) TrayTip("", "", 0) EndIf If Not FileExists($sFile) Then MsgBox(262192, "Download", "Download failed!") Exit EndIf Global $aGIFDimension = _GIFGetDimension($sFile) Global $hGui = GUICreate("GIF Animation", $aGIFDimension[0], $aGIFDimension[1], -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetBkColor(345) _WinAPI_SetLayeredWindowAttributes($hGui, 345, 255) ; GIF job Global $aGIFArrayOfIconHandles Global $hGIFThread Global $iGIFTransparent Global $tFrameCurrent Global $hGIF = _GUICtrlCreateGIF($sFile, 0, 0, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent) GUICtrlSetTip(-1, "ESC to exit") GUISetState() While 1 If GUIGetMsg() = - 3 Then Exit WEndGIF will be downloaded. ESC key to exit.edit: I must say that there is a bug with new AutoIt that could cause GIFAnimation.au3 not to work as intended. Nothing major but nevertheless. I'm sure bug will be fixed with new beta.If not I will update GIFAnimation.au3 to go around that. Edited August 1, 2010 by trancexx ♡♡♡ . eMyvnE
ValeryVal Posted December 25, 2009 Posted December 25, 2009 Great dance with a script. Should dancing in script be more fun with Christmas tree? expandcollapse popup#include <WindowsConstants.au3> #include <WinAPI.au3> #include "GIFAnimation.au3" Global $WinX = 0, $WinY = 0, $Pos = 0 Opt("GUICloseOnESC", 1); ESC to exit Opt("MustDeclareVars", 1) HotKeySet("^g", "PosChange") If @AutoItX64 Then ConsoleWriteError("! 32-bit only" & @CRLF) MsgBox(262192, "32-bit", "This is 32-bit script.") Exit EndIf Global $sTempFolder = @TempDir & "\GIFS" DirCreate($sTempFolder) Global $sFile = $sTempFolder & "\elka_2.gif" If Not FileExists($sFile) Then TrayTip("GIF Download", "Please wait...", 0) InetGet("http://mobilewallpapers.narod.ru/holidays/images/elka_2.gif", $sFile) TrayTip("", "", 0) EndIf If Not FileExists($sFile) Then MsgBox(262192, "Download", "Download failed!") Exit EndIf Global $aGIFDimension = _GIFGetDimension($sFile) Global $hGui = GUICreate("GIF Animation", $aGIFDimension[0], $aGIFDimension[1], $WinX, $WinY, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetBkColor(345) _WinAPI_SetLayeredWindowAttributes($hGui, 345, 255) ; GIF job Global $aGIFArrayOfIconHandles Global $hGIFThread Global $iGIFTransparent Global $tFrameCurrent Global $hGIF = _GUICtrlCreateGIF($sFile, 0, 0, $aGIFArrayOfIconHandles, $hGIFThread, $iGIFTransparent, $tFrameCurrent) GUICtrlSetTip(-1, "ESC to exit, Ctrl-G to move") GUISetState() While 1 If GUIGetMsg() = - 3 Then Exit WEnd func PosChange() Switch $Pos case 0 $WinX = @DesktopWidth-$aGIFDimension[0] case 1 $WinY = @DesktopHeight-$aGIFDimension[1] case 2 $WinX = 0 case 3 $WinY = 0 EndSwitch $Pos = mod($Pos+1, 5) if $Pos = 4 then WinMove("GIF Animation", "", (@DesktopWidth-$aGIFDimension[0])/2, (@DesktopHeight-$aGIFDimension[1])/2) else WinMove("GIF Animation", "", $WinX, $WinY) endif endfunc You can move it in other position by Ctrl-G. Mary Christmas! Thank you. The point of world view
slayerz Posted December 27, 2009 Posted December 27, 2009 Finally, the transparent animated GIF is possible in autoit.... tq for the examples AUTOIT[sup] I'm lovin' it![/sup]
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