Multiple progress bars/loops

Get help with using AutoHotkey and its commands and hotkeys
choui
Posts: 2
Joined: 05 Mar 2018, 15:50

Multiple progress bars/loops

17 Mar 2018, 14:43

Hi, I'm having trouble getting multiple progress bars to run simultaneously in a gui.

Here is an example, I want them to work as they do now (restarting themselves when i press the same key), but I don't want them to stop/delay eachother.
i.e pressing 2doesn't stop 1 etc.

Code: Select all

Gui, Main: New
Gui, Main: Show, w450 h450

Gui, 1: +parentMain
Gui, 1: Color, c292929
Gui, 1: Add, Progress, x0 y0 w300 h20 cGreen +Border vGreen
Gui, 1: Show, x5 y5 w300 h20

Gui, 2: +parentMain
Gui, 2: Color, c292929
Gui, 2: Add, Progress, x0 y0 w300 h20 cBlue +Border vBlue
Gui, 2: Show, x5 y50 w300 h20

Gui, 3: +parentMain
Gui, 3: Color, c292929
Gui, 3: Add, Progress, x0 y0 w300 h20 cBlack +Border vBlack
Gui, 3: Show, x5 y95 w300 h20
Return

1::
GuiControl, 1:, Green, 0
KeyWait, 1
Loop 100 
{
	GuiControl, 1:, Green, +1
	KeyWait, 1, D T0   
	
	If (!ErrorLevel)
		GoTo, 1
	Sleep, 1
}
GuiControl, 1:, Green, 0
Return

2::
GuiControl, 2:, Blue, 0
KeyWait, 2
Loop 100 
{
	GuiControl, 2:, Blue, +1
	KeyWait, 2, D T0   
	If (!ErrorLevel)
		Goto, 2
	Sleep, 1
}
GuiControl, 2:, Blue, 0
Return

3::
GuiControl, 3:, Black, 0
KeyWait, 3
Loop 100 
{
	GuiControl, 3:, Black, +1
	KeyWait, 3, D T0   
	If (!ErrorLevel)
		Goto, 3
	Sleep, 1
}
GuiControl, 3:, Black, 0
Return

ESC::ExitApp
Any help or guidance I can get are really appreciated, thanks
User avatar
noname
Posts: 509
Joined: 19 Nov 2013, 09:15

Re: Multiple progress bars/loops

18 Mar 2018, 13:24

I guess a settimer would solve it if the timing is not too critical.

example:

Code: Select all



Gui, Main: New
Gui, Main: Show, w450 h450

Gui, 1: +parentMain
Gui, 1: Color, c292929
Gui, 1: Add, Progress, x0 y0 w300 h20 cGreen +Border vGreen
Gui, 1: Show, x5 y5 w300 h20

Gui, 2: +parentMain
Gui, 2: Color, c292929
Gui, 2: Add, Progress, x0 y0 w300 h20 cBlue +Border vBlue
Gui, 2: Show, x5 y50 w300 h20

Gui, 3: +parentMain
Gui, 3: Color, c292929
Gui, 3: Add, Progress, x0 y0 w300 h20 cBlack +Border vBlack
Gui, 3: Show, x5 y95 w300 h20
Return


1::
counter1:=0
settimer,loop1,100
return


loop1:
counter1++
GuiControl, 1:, Green, % counter1

if (counter1=100)
  {
  SetTimer, loop1,off
  counter1:=0
  }
return


2::
counter2:=0
settimer,loop2,100
return


loop2:
counter2++
GuiControl, 2:, Blue, % counter2

if (counter2=100)
  {
  SetTimer, loop2,off
  counter2:=0
  }
return


3::
counter3:=0
settimer,loop3,100
return


loop3:
counter3++
GuiControl, 3:, Black, % counter3

if (counter3=300)
  {
  SetTimer, loop3,off
  counter3:=0
  }
return

ESC::ExitApp
soundcloud.com/user-32706894

Return to “Ask For Help”

Who is online

Users browsing this forum: AlexV, Bing [Bot], Chunjee, flipmania, Google [Bot], ttttt, v3Van and 225 guests