HI, I have simple script that plays a gif when the control key is pressed down. It closes when the control is released. My goal with this is to create very short how to vids when a key is pressed. I'm new to autohotkey so i'm picking this up as i go along. I have no real experience in coding. So i've put this together from bits I've found.The problem i have with the script is it only runs once even if i put the #Persistent tag. I want this to be there in the background so whenever the user holds down the key the animation plays.
keywait, Ctrl, D
file := "C:\Users\JV\Desktop\GIFAHK\kanye.gif"
Gui, Margin, 1, 1
Gui, +HwndhWndGifAnim +Resize +LabelGifAnimationSampleGui ; Set it
AnimatedGifControl(hWndGifAnim, file, "hWndhWndGifAnimControl")
Gui, Show,, Animated Gif Gui Control Sample 3
GuiControl, Move, % hWndGifAnimControl, % "H" (A_GuiHeight-20) " W"
WinActivate, Animated Gif Gui Control Sample 3,
WinWaitActive, Animated Gif Gui Control Sample 3,
WinKill, Animated Gif Gui Control Sample 3
MsgBox You released control key
Get help with using AutoHotkey and its commands and hotkeys
3 posts • Page 1 of 1
It stays running for me. I had to comment out the AnimatedGifControl() function call, though, because you didn't provide that. That could mean that that function is exiting the script, either deliberately or by crashing.
Last edited by Osprey on 26 Apr 2019, 03:08, edited 1 time in total.
For some reason it wasn't working but then after a restart it started working again. Maybe it was a bug or because i had my machine on hibernate earlier. Thanks for the reply.