Progress bar help Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Spark
Posts: 80
Joined: 04 Jan 2017, 02:22

Progress bar help

23 Sep 2018, 22:25

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
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Progress bar help  Topic is solved

23 Sep 2018, 23:26

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.
Spark
Posts: 80
Joined: 04 Jan 2017, 02:22

Re: Progress bar help

24 Sep 2018, 00:48

@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
Spark
Posts: 80
Joined: 04 Jan 2017, 02:22

Re: Progress bar help

24 Sep 2018, 01:32

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
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Progress bar help

24 Sep 2018, 01:35

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.
Spark
Posts: 80
Joined: 04 Jan 2017, 02:22

Re: Progress bar help

24 Sep 2018, 02:21

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:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AHK_user and 195 guests