Page 1 of 1

Progress bar help

Posted: 23 Sep 2018, 22:25
by Spark
is there a better way to make progress bar in my case?

Code: Select all

`::
Progress, b2 w200,,,
Progress, 0 
	func1()
Progress, 20
	func2()
Progress, 40
	func3()
Progress, 60 
	func4()
Progress, 80 
	func5()
Progress, 100
Progress, Off
return

func1(){
	ToolTip, one, 5, 5, 2
	Sleep, 1000
	ToolTip, two, 5, 5, 2
	Sleep, 1000
}
func2(){
	ToolTip, three, 5, 5, 2
	Sleep, 1000
	ToolTip, four, 5, 5, 2
	Sleep, 1000
}
func3(){
	ToolTip, five, 5, 5, 2
	Sleep, 1000
	ToolTip, six, 5, 5, 2
	Sleep, 1000
}
func4(){
	ToolTip, seven, 5, 5, 2
	Sleep, 1000
	ToolTip, eight, 5, 5, 2
	Sleep, 1000
}
func5(){
	ToolTip, nine, 5, 5, 2
	Sleep, 1000
	ToolTip, ten, 5, 5, 2
	Sleep, 1000
	ToolTip,, 5, 5, 2
}
thanks in advance

Re: Progress bar help  Topic is solved

Posted: 23 Sep 2018, 23:26
by wolf_II
to make faster progress, reduce your sleep times :? :D

Try this:

Code: Select all

`::
    Progress, b2 w200,,,
    Loop, 5    {
        Progress, % (A_Index - 1) * 20
        func%A_Index%()
    }
    Progress, 100
    Progress, Off
return



func1(){
	ToolTip, one, 5, 5, 2
	Sleep, 1000
	ToolTip, two, 5, 5, 2
	Sleep, 1000
}
func2(){
	ToolTip, three, 5, 5, 2
	Sleep, 1000
	ToolTip, four, 5, 5, 2
	Sleep, 1000
}
func3(){
	ToolTip, five, 5, 5, 2
	Sleep, 1000
	ToolTip, six, 5, 5, 2
	Sleep, 1000
}
func4(){
	ToolTip, seven, 5, 5, 2
	Sleep, 1000
	ToolTip, eight, 5, 5, 2
	Sleep, 1000
}
func5(){
	ToolTip, nine, 5, 5, 2
	Sleep, 1000
	ToolTip, ten, 5, 5, 2
	Sleep, 1000
	ToolTip,, 5, 5, 2
}
I hope that helps.

Re: Progress bar help

Posted: 24 Sep 2018, 00:48
by Spark
@wolf_II
your code works perfectly, thanks :bravo:
another question (if you don't mind)
what if the function name is different?
for example :

Code: Select all

alpha()
beta()
charlie()
delta()
how to make it work ?

thanks

Re: Progress bar help

Posted: 24 Sep 2018, 01:32
by Spark
problem solved

Code: Select all

arr := {1:"alpha", 2:"beta", 3:"charlie", 4:"delta", 5:"echo"}
`::
Progress, b2 w200,,,
Loop, 5 {
	Progress, % (A_Index - 1) * 20
	arr[A_Index]()
}
	Progress, 100
    Progress, Off
return

alpha(){
	ToolTip, one, 5, 5, 2
	Sleep, 1000
	ToolTip, two, 5, 5, 2
	Sleep, 1000
}
beta(){
	ToolTip, three, 5, 5, 2
	Sleep, 1000
	ToolTip, four, 5, 5, 2
	Sleep, 1000
}
charlie(){
	ToolTip, five, 5, 5, 2
	Sleep, 1000
	ToolTip, six, 5, 5, 2
	Sleep, 1000
}
delta(){
	ToolTip, seven, 5, 5, 2
	Sleep, 1000
	ToolTip, eight, 5, 5, 2
	Sleep, 1000
}
echo(){
	ToolTip, nine, 5, 5, 2
	Sleep, 1000
	ToolTip, ten, 5, 5, 2
	Sleep, 1000
}
thanks

Re: Progress bar help

Posted: 24 Sep 2018, 01:35
by wolf_II
Try this also:

Code: Select all

`::
    Progress, b2 w200,,,
    for each, fn in ["alpha", "beta", "charlie", "delta", "jack"]
    {
        Progress, % (A_Index - 1) * 20
        %fn%()
    }
    Progress, 100
    Progress, Off
return


alpha(){
	ToolTip, one, 5, 5, 2
	Sleep, 1000
	ToolTip, two, 5, 5, 2
	Sleep, 1000
}
beta(){
	ToolTip, three, 5, 5, 2
	Sleep, 1000
	ToolTip, four, 5, 5, 2
	Sleep, 1000
}
charlie(){
	ToolTip, five, 5, 5, 2
	Sleep, 1000
	ToolTip, six, 5, 5, 2
	Sleep, 1000
}
delta(){
	ToolTip, seven, 5, 5, 2
	Sleep, 1000
	ToolTip, eight, 5, 5, 2
	Sleep, 1000
}
jack(){
	ToolTip, nine, 5, 5, 2
	Sleep, 1000
	ToolTip, ten, 5, 5, 2
	Sleep, 1000
	ToolTip,, 5, 5, 2
}
I hope that helps.

Re: Progress bar help

Posted: 24 Sep 2018, 02:21
by Spark
wolf_II wrote:Try this also:

Code: Select all

`::
    Progress, b2 w200,,,
    for each, fn in ["alpha", "beta", "charlie", "delta", "jack"]
    {
        Progress, % (A_Index - 1) * 20
        %fn%()
    }
    Progress, 100
    Progress, Off
return


alpha(){
	ToolTip, one, 5, 5, 2
	Sleep, 1000
	ToolTip, two, 5, 5, 2
	Sleep, 1000
}
beta(){
	ToolTip, three, 5, 5, 2
	Sleep, 1000
	ToolTip, four, 5, 5, 2
	Sleep, 1000
}
charlie(){
	ToolTip, five, 5, 5, 2
	Sleep, 1000
	ToolTip, six, 5, 5, 2
	Sleep, 1000
}
delta(){
	ToolTip, seven, 5, 5, 2
	Sleep, 1000
	ToolTip, eight, 5, 5, 2
	Sleep, 1000
}
jack(){
	ToolTip, nine, 5, 5, 2
	Sleep, 1000
	ToolTip, ten, 5, 5, 2
	Sleep, 1000
	ToolTip,, 5, 5, 2
}
I hope that helps.
great thanks :thumbup: