.gif Animation on gui
.gif Animation on gui
Original post http://www.autohotkey.com/board/topic/1 ... gui/page-1
All credits goes to him and its creators, not me
I just wanted to keep, and share this nice library!
AniGif.dll enables your gui to animate .gif images
Download (Dll, Library and Example are included)
http://me2.do/G6pXZMwg
All credits goes to him and its creators, not me
I just wanted to keep, and share this nice library!
AniGif.dll enables your gui to animate .gif images
Download (Dll, Library and Example are included)
http://me2.do/G6pXZMwg
AutoHotkey & AutoHotkey_H v1.1.22.07
Re: .gif Animation on gui
That's a nice capability. Thanks for posting it. I've seen it before and unfortunately it has usage restrictions that wouldn't let me use if for one of my purposes, so I made a function that allows adding an animated GIF to a GUI with just a simple function call. It will automatically figure out the size of the GIF on its own, so you don't have to, which can be a pain in sizing the ActiveX control so it doesn't create an extra border around your image.
One problem it has is that if you add more than one animated GIF with it, often one of them would be frozen or wouldn't be shown. But if you want just one, this seems to work well. I don't know if the dll-based version you posted will show multiple GIFs without problems.
With this function, you can pass all the standard position and size parameters, and it will return the control name so you can manipulate it as my demo shows (hides and unhides it). You can also specify which GUI to add it to if not the default GUI. It will allow you to add up to 10 GIFs, so add more than one if you'd like to see if it works out for you. They each get their own control name. I'm posting it in case anyone might want a smaller, self-contained, and open-use alternative.
One problem it has is that if you add more than one animated GIF with it, often one of them would be frozen or wouldn't be shown. But if you want just one, this seems to work well. I don't know if the dll-based version you posted will show multiple GIFs without problems.
With this function, you can pass all the standard position and size parameters, and it will return the control name so you can manipulate it as my demo shows (hides and unhides it). You can also specify which GUI to add it to if not the default GUI. It will allow you to add up to 10 GIFs, so add more than one if you'd like to see if it works out for you. They each get their own control name. I'm posting it in case anyone might want a smaller, self-contained, and open-use alternative.
Code: Select all
; Demo the function:
AnimPicFile := A_ScriptDir "\watch your step.gif" ; replace with full path to your gif
Gui, +ToolWindow
Gui, Add, Text, vTextCont, Will hide gif in 3 seconds
AGif := AddAnimatedGIF(AnimPicFile)
Gui, Show
Sleep, 3000
GuiControl,, TextCont, Hidden for 3 seconds
GuiControl, Hide, %AGif%
Gui, Show
Sleep, 3000
GuiControl,, TextCont, It's back
GuiControl, Show, %AGif%
Gui, Show
return
; **** AddAnimatedGIF function by boiler ****
; imagefullpath: must be the full path to the animated GIF image file
; x, y: optional strings containing position info that would normally follow x and y options, such as 10, "p+3", "m"
; w, h: optional width and height values that would normally follow w and h options; blank for full size image
; guiname: optional name of the gui to add the image to if not the main one
;
; function returns the name of the control that was added so that you can modify it (move, hide) with GuiControl
; can add up to animated GIF images. to increase the limit, add AG11,AG12,... to the global statement
;
AddAnimatedGIF(imagefullpath , x="", y="", w="", h="", guiname = "1")
{
global AG1,AG2,AG3,AG4,AG5,AG6,AG7,AG8,AG9,AG10
static AGcount:=0, pic
AGcount++
html := "<html><body style='background-color: transparent' style='overflow:hidden' leftmargin='0' topmargin='0'><img src='" imagefullpath "' width=" w " height=" h " border=0 padding=0></body></html>"
Gui, AnimGifxx:Add, Picture, vpic, %imagefullpath%
GuiControlGet, pic, AnimGifxx:Pos
Gui, AnimGifxx:Destroy
Gui, %guiname%:Add, ActiveX, % (x = "" ? " " : " x" x ) . (y = "" ? " " : " y" y ) . (w = "" ? " w" picW : " w" w ) . (h = "" ? " h" picH : " h" h ) " vAG" AGcount, Shell.Explorer
AG%AGcount%.navigate("about:blank")
AG%AGcount%.document.write(html)
return "AG" AGcount
}
GuiClose:
ExitApp
Re: .gif Animation on gui
@boiler / your version is cool!, nicely minimizied.
dll version allow you to animate multiple gif at the same time, and remove used one from gui
dll version allow you to animate multiple gif at the same time, and remove used one from gui
AutoHotkey & AutoHotkey_H v1.1.22.07
Re: .gif Animation on gui
Thanks, Soft. That's good to know about the dll version. Sounds very robust and useful. That's why I didn't post mine before. It bugged me that it didn't work well with more than one gif, so I didn't think it was worth a new thread. I thought it might have something to do with more than one ActiveX control going at the same time.
-
- Posts: 934
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: .gif Animation on gui
@boiler
How to change AG1 to a different GIF?
I have a GIF in the User interface and then, on a button push, I want it changed to a different .GIF, with new size and position.
I never want more than one GIF into the UI.
Best regards, Marius.
How to change AG1 to a different GIF?
I have a GIF in the User interface and then, on a button push, I want it changed to a different .GIF, with new size and position.
I never want more than one GIF into the UI.
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
-
- Posts: 934
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: .gif Animation on gui
If I add only one GIF into the GUI.... And I try to use....
AG1.navigate("about:blank")
AG1.document.write(html)
The page gets blank (white)....
I'm using an updated html variable....
Any suggestions? Thank you.
Best regards, Marius.
AG1.navigate("about:blank")
AG1.document.write(html)
The page gets blank (white)....
I'm using an updated html variable....
Code: Select all
html := "<html><body style='background-color: transparent' style='overflow:hidden' leftmargin='0' topmargin='0'><img src='" imageNewFullpath "' width=" w " height=" h " border=0 padding=0></body></html>"
Any suggestions? Thank you.
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: .gif Animation on gui
Do you have valid values assigned to the variables imageNewFullPath, w, and h prior to your statement where you assign the value to the variable html? If not, you don't have a valid html string.
-
- Posts: 934
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: .gif Animation on gui
Yes, I do. I feed valid values to the html. Does that work for you?
Right now, I made it such that I recreate the GUI each time I change the GIF animation, however it's utterly dumb.
I can't get it working without recreating the GUI. Any ideas?
Best regards, Marius.
Right now, I made it such that I recreate the GUI each time I change the GIF animation, however it's utterly dumb.
I can't get it working without recreating the GUI. Any ideas?
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: .gif Animation on gui
I haven't tried making that work, but I believe that it would be the same for me. I imagine the way the document object works, it's not meant to have a new html written to it. I recommend adding a second image and switch between them using GuiControl, Hide and GuiControl, Show.
-
- Posts: 934
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: .gif Animation on gui
Thanks for the suggestion, but in my case that's not a solution, because I'm developing an image viewer..... Therefore it must work with "countless" files, not just two. I'm going to post it soon. (in a week or two)
Best regards, Marius.
Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: .gif Animation on gui
I tried the script above by boiler - just changed the path to my animated gif but it just shows the white empty space without image.
Any hint? I'm using a 4K monitor it this is relevant... thanks!
Any hint? I'm using a 4K monitor it this is relevant... thanks!
Re: .gif Animation on gui
Just tried it again in case something changed with the latest OS updates, and it works fine. I don't have a 4K monitor to test it on. How did you define the path to your gif? Can you show that line of your code?
Edit: I just noticed I answered a post that's about a year old. My notifications show there was a reply from @mackc that is currently no longer there. Perhaps mackc is a new user who edited the post and it is in the approval queue. Or perhaps it was deleted. In any case, my reply was in response to @m3user's post which I am just seeing now.
Edit: I just noticed I answered a post that's about a year old. My notifications show there was a reply from @mackc that is currently no longer there. Perhaps mackc is a new user who edited the post and it is in the approval queue. Or perhaps it was deleted. In any case, my reply was in response to @m3user's post which I am just seeing now.
Re: .gif Animation on gui
yeah, that user mackc was banned for posting spam.boiler wrote: ↑27 Dec 2021, 14:20Edit: I just noticed I answered a post that's about a year old. My notifications show there was a reply from @mackc that is currently no longer there. Perhaps mackc is a new user who edited the post and it is in the approval queue. Or perhaps it was deleted. In any case, my reply was in response to @m3user's post which I am just seeing now.
- Stinkfoot9
- Posts: 51
- Joined: 29 May 2022, 12:17
Re: .gif Animation on gui
@boiler Hi boiler nice gif script simple is best.. I'm going to plug it into my desktop image previewer.
One thing
I resized the image to W500 H-1 But can't figure out how to resize the window to w500 h-1 to match.
One thing
I resized the image to W500 H-1 But can't figure out how to resize the window to w500 h-1 to match.
Check out my other scripts
Context Menu Clipboard History , Desktop image preview on hover , Cycle Win Taskbar tabs in order win11
Context Menu Clipboard History , Desktop image preview on hover , Cycle Win Taskbar tabs in order win11
Re: .gif Animation on gui
Try getting the size of the control using GuiControlGet, then resize the GUI window accordingly.Stinkfoot9 wrote: ↑ I resized the image to W500 H-1 But can't figure out how to resize the window to w500 h-1 to match.