 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Uminnsky
Joined: 12 Aug 2009 Posts: 26
|
Posted: Thu Sep 24, 2009 5:25 pm Post subject: Making an hour glass type progress bar |
|
|
I have given up trying to actually time my script with the progress bar, to many files and dozens of loops. Is there a simple way to code the progress bar to just loop from 0-100% continuously until the entire script is finished?
Thanks! |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 3113 Location: MN, USA
|
|
| Back to top |
|
 |
Uminnsky
Joined: 12 Aug 2009 Posts: 26
|
Posted: Thu Sep 24, 2009 6:31 pm Post subject: |
|
|
Thanks for the reply. It appears that it is still trying to base the progress bar in accordance with progress of the script and or its "time." I want a completely unintelligent progress bar that does nothing more than "blink" so the user knows the process isn't dead. Something like:
Loop
{
Gui, Progess, 50
GUI, Progress, 100
Gui, Progress, 0
}
Of course the problem is that the rest of my script wouldn't run because it would be stuck on this loop. |
|
| Back to top |
|
 |
tidbit
Joined: 09 Mar 2008 Posts: 1807 Location: Minnesota, USA
|
Posted: Thu Sep 24, 2009 6:36 pm Post subject: |
|
|
try using a settimer instead of a loop? _________________ rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
Even monkeys fall from trees. - Japanese proverb |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 3113 Location: MN, USA
|
Posted: Thu Sep 24, 2009 7:19 pm Post subject: Re: Making an hour glass type progress bar |
|
|
| Uminnsky wrote: | | I have given up trying to actually time my script with the progress bar | Don't give up! Doesn't the thread I linked to help with this?
| Uminnsky wrote: | | Is there a simple way to code the progress bar to just loop from 0-100% continuously until the entire script is finished? | You would need a timer, as tidbit suggested. You may also want to use the PBS_MARQUEE style (0x8) on your progress bar. | AHK Help File wrote: | This style is typically used to indicate an ongoing operation whose completion time is unknown.
|
| Code: | Gui, Add, Text,,Please Wait...
Gui, Add, Progress, r2 w200 0x8 -Smooth vPrgs
SetTimer, Progress, 100
;rest of script here
Gui, Show
return
GuiClose:
ExitApp
Progress:
GuiControl,,Prgs
return |
|
|
| Back to top |
|
 |
randallf
Joined: 06 Jul 2009 Posts: 678
|
Posted: Thu Sep 24, 2009 8:52 pm Post subject: |
|
|
This may help, I use this for program messages.
Just use
| Code: | Message := "Please Wait..."
GoSub MessageUp
<code to wait for>
GoSub MessageDown |
Potentially you could 'animate' this so with GuiControl so that it goes
Please wait.
Please wait..
Please wait...
Please wait.
Etc
| Code: | MessageUp:
Gui 3: Margin, 0,0
Gui 3: +LastFound
GUI_ID:=WinExist()
Gui 3: font, s16, Arial
Gui 3: -Caption +AlwaysOnTop +Border
Gui 3: Add, text,,%message%
Gui 3: font, s5, Arial
Gui 3: Show, AutoSize xCenter yCenter NoActivate, Working...
DllCall("AnimateWindow","UInt",GUI_ID,"Int",250,"UInt","0xa0000")
Return
MessageDown:
DllCall("AnimateWindow","UInt",GUI_ID,"Int",250,"UInt","0x90000")
Gui 3: Destroy
Return |
|
|
| Back to top |
|
 |
Uminnsky
Joined: 12 Aug 2009 Posts: 26
|
Posted: Thu Sep 24, 2009 10:38 pm Post subject: |
|
|
Thanks for the help...concerning the timer, I have never played with this before, but it still seems to stick on the label like a loop would. In the code below how can I get beyond the label to my code and still have the label conintually executing?
EDIT: Nevermind, put the code BEFORE the time label, i got it...thanks for the help
EDIT 2: This is still no good though, makes the code run like a snail. Does it break between each line of code to run the label?
| Code: | Gui, Add, Progress, x96 y280 w330 h50 vprogress, 25
Gui, Add, Button, x66 y60 w100 h30 , run
Gui, Show, w477 h377, New GUI Window
return
Buttonrun:
SetTimer, timelabel, 1000
timelabel:
GUIcontrol,,progress, 25
sleep 500
GUIcontrol,,progress, 50
sleep, 500
GUIcontrol,, progress, 75
sleep, 500
GUIcontrol,, progress, 100
return
sleep 5000 ; my code
msgbox, test
return
GuiClose:
ExitApp |
|
|
| Back to top |
|
 |
Uminnsky
Joined: 12 Aug 2009 Posts: 26
|
Posted: Thu Sep 24, 2009 11:12 pm Post subject: Re: Making an hour glass type progress bar |
|
|
| Quote: | [quote="jaco0646"] | Uminnsky wrote: | | I have given up trying to actually time my script with the progress bar | Don't give up! Doesn't the thread I linked to help with this? |
I am sure it should , but I am not easily following how to connect that with my code. |
|
| Back to top |
|
 |
gwarble
Joined: 23 May 2009 Posts: 229 Location: north bay, california
|
Posted: Fri Sep 25, 2009 5:56 am Post subject: |
|
|
probably should get rid of the sleeps in there, and call the timer when you want to update...
something like:
| Code: |
TempProgress = 0
SetTimer, ProgressUpdate, 1000
Return ;=== end auto-execute
ProgressUpdate: ;=== increases TempProgress by 10 each second
GUIcontrol,,progress, % TempProgress += 10
If TempProgress > 100
TempProgess = 0
Return |
|
|
| Back to top |
|
 |
gwarble
Joined: 23 May 2009 Posts: 229 Location: north bay, california
|
Posted: Fri Sep 25, 2009 6:04 am Post subject: |
|
|
| Code: | Gui, Add, Progress, x96 y280 w330 h50 vprogress, 25
Gui, Add, Button, x66 y60 w100 h30 , run
Gui, Show, w477 h377, New GUI Window
Return
Buttonrun:
TempProgress = 1
GUIcontrol,,progress, 0
SetTimer, ProgressUpdate, 200
Return
ProgressUpdate:
If (TempProgress *= 1.2) > 100
TempProgress = 1
GUIcontrol,,progress, % TempProgress
Return |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|