AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Attaching Animated GIF to process and keeping it on top

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Ricardo111
Guest





PostPosted: Fri Jun 09, 2006 1:20 pm    Post subject: Attaching Animated GIF to process and keeping it on top Reply with quote

I have written a tool which exports a table from a database into Word. This tool utilises a lot of word macros to process the information parsed from the database, so it can sometimes take upwards of an hour. To speed up the process I have switched off the screen updating, the user therefore has no indication of how long the export will take and sometimes kills the process thinking its locked up when it hasn't.

I want autohotkey to get a handle to the macro container fire an animated gif, keep it on top of all windows then kill the animated GIF when the process has finished/ macro container is closed. Is there anyone out there who knows how to do this.

Thanks a lot for any advice.

Richard
Back to top
BoBo
Guest





PostPosted: Fri Jun 09, 2006 1:49 pm    Post subject: Reply with quote

Have you checked AHK's Progress command already ??

Quote:
Progress / SplashImage
--------------------------------------------------------------------------------
Creates or updates a window containing a progress bar or an image.
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Fri Jun 09, 2006 2:04 pm    Post subject: Re: Attaching Animated GIF to process and keeping it on top Reply with quote

Dear Ricardo111, Smile

Ricardo111 wrote:
Thanks a lot for any advice.


Animated GIF's are not supported in AHK.
Alternatively, it may help to flash the Tray Icon of your script.

The following is BoBo's technique of Animating Tray Icon.

Code:
#Persistent
SetTimer, ChangeIcon, 500
Return

^#X::ExitApp

ChangeIcon:
If (!Icon) {
Menu,Tray,Icon,%A_AhkPath%,1
Icon=1
}
else {
Menu,Tray,Icon,%A_AhkPath%,4
Icon=0
}
Return


Regards, Smile
_________________
Suresh Kumar A N
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Fri Jun 09, 2006 2:05 pm    Post subject: Reply with quote

Here is an another way....

Code:
#Persistent

FlashPause=500
IconSize=32

Gui, Color, EEAA99
Gui +LastFound 
WinSet, TransColor, EEAA99
Gui  +AlwaysOnTop -Caption
Gui, Margin, 0,0
Gui, Add, Picture, w%IconSize% h%IconSize% Icon4 vPic gTrayMenu, User32.dll
Gui, Show, x20 y20, Program Alert
SetTimer, ChangeIcon, %FlashPause%
Return

ChangeIcon:
If (!Icon) {
GuiControl, ,Pic,*ICON4 *w%IconSize% *h%IconSize% User32.dll
Icon=1
}
else {
GuiControl, ,Pic, Null
Icon=0
}
Return

TrayMenu:
Menu,Tray,Show
Return


Regards, Smile
_________________
Suresh Kumar A N
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6786
Location: France (near Paris)

PostPosted: Fri Jun 09, 2006 3:33 pm    Post subject: Reply with quote

Or make an animation non-Gif based...
Code:
;~ SetBatchLines -1
message = RUNNING, WAIT PLEASE!
len := StrLen(message)
xMargin := 50
initialYPos := 20
charW := (A_ScreenWidth - 3 * xMargin) / len

Gui +ToolWindow +AlwaysOnTop +Disable -SysMenu -Caption
Gui Color, 000000
Gui Font, s48, Courier New
Gui Font, , Andale Mono
Loop Parse, message
{
   xPos := xMargin + charW * A_Index
   Gui Add, Text, vp%A_Index% cLime x%xPos% y%initialYPos%, %A_LoopField%
   xPos%A_Index% := xPos
   yPos%A_Index% := initialYPos
}
Gui +LastFound
WinSet, Transparent, 128
Gui Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%, Splash
SetTimer Animate, 200
Return

GuiEscape:
ExitApp

Animate:
   yMin := 0
   Loop %len%
   {
      Random r, 5, 20
;~       Random r, 20, 100   ; Much faster, for tests...
      yPos%A_Index% += r
      if (yPos%A_Index% > yMin)
         yMin := yPos
      Gosub MoveControls
   }
   if (yMin > A_ScreenHeight)
   {
      Loop %len%
      {
         yPos%A_Index% := initialYPos
      }
      yMin := 0
      Gosub MoveControls
   }
Return

MoveControls:
   Loop %len%
   {
      xPos := xPos%A_Index%
      yPos := yPos%A_Index%
      GuiControl Move, p%A_Index%, x%xPos% y%yPos%
   }
Return

_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 7609

PostPosted: Fri Jun 09, 2006 3:39 pm    Post subject: Reply with quote

Dear PhiLho, Very Happy

This effect is Excellent!

Regards, Very Happy
_________________
Suresh Kumar A N
Back to top
View user's profile Send private message
Ricardo111
Guest





PostPosted: Mon Jun 12, 2006 8:58 am    Post subject: Reply with quote

Guys,
Thanks a lot for the replies and ideas. I'll have a bash at implementing somthing today.

Regards,

Richard
Back to top
BoBo
Guest





PostPosted: Mon Jun 12, 2006 9:10 am    Post subject: Reply with quote

Quote:
Dear PhiLho,
This effect is Excellent!
... and should be added to the Scripts&Functions section if not done already. Thx. Very Happy
Back to top
Ricardo111
Guest





PostPosted: Mon Jun 12, 2006 1:28 pm    Post subject: Reply with quote

Phillipe,
My compliments, that was exactly what was needed. Didn't need the animation to be as flash as you had it so I have simplified it for my own needs

Code:

message = Exporting, Please Wait!
len := StrLen(message)
xMargin := 200
initialYPos := 20
charW := (A_ScreenWidth - 3 * xMargin) / len

Gui +ToolWindow +AlwaysOnTop +Disable -SysMenu -Caption
Gui Color, 000000
Gui Font, s48, Courier New
Gui Font, , Andale Mono

xPos := xMargin + charW
Gui Add, Text, vpSod cLime x%xPos% y%initialYPos%, %message%
xPos := xPos
yPos := initialYPos

Gui +LastFound
WinSet, Transparent, 128
Gui Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%, Splash
SetTimer Animate, 600
WinWaitClose, DocProducer4
ExitApp
Return

GuiEscape:
ExitApp

Animate:
   yMin := 0
     yPos+= 5
     if (yPos > yMin)
        yMin := yPos

      if (yMin > A_ScreenHeight-100)
      {
       yPos := initialYPos
         yMin := 0
     
      }
   GuiControl Move, pSod, x%xPos% y%yPos%
Return


Best Regards,

Richard
Back to top
PhiLho



Joined: 27 Dec 2005
Posts: 6786
Location: France (near Paris)

PostPosted: Tue Jun 13, 2006 2:54 pm    Post subject: Reply with quote

BoBo wrote:
Quote:
This effect is Excellent!
... and should be added to the Scripts&Functions section if not done already. Thx. Very Happy
Funny, when I read this comment, I was already working on an improved version... It is a kind of splash screen framework...
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
Veovis



Joined: 13 Feb 2006
Posts: 389
Location: Utah

PostPosted: Tue Jun 13, 2006 5:45 pm    Post subject: Reply with quote

I liked the effect, but my CPU was completely bogged down (1Ghz 384 Ram Dell Latitute Laptop) and even my mouse was moving slowly.

Rather Humorously i didnt read the code before i executed it, and i tried to right click the tray icon and of course it didnt work. So i had to read the code through the faded screen thing, and find that escape closed it Very Happy Laughing
_________________

"Power can be given overnight, but responsibility must be taught. Long years go into its making."
Back to top
View user's profile Send private message Send e-mail Visit poster's website
PhiLho



Joined: 27 Dec 2005
Posts: 6786
Location: France (near Paris)

PostPosted: Wed Jun 14, 2006 9:04 am    Post subject: Reply with quote

Yes, I try to remember to put this key in most of my scripts, it can be a lifesaver sometime...
I didn't knew it was so CPU intensive, I tested in on my Pentium 4 2.8GHz...
Of course, you can play with the SetTimer value, 200ms is perhaps a bit too much, we are not in a hurry, as long as it moves... Smile
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group