progress RANGE not working Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mewscwb
Posts: 14
Joined: 21 Jun 2022, 08:55

progress RANGE not working

Post by mewscwb » 22 Jul 2022, 12:17

Gui new
Gui Add, Progress, w600 h20 cBlue backgroundyellow vProgbar
Gui show
myvar := 30 ;any arbitrary value
GuiControl ,,progbar, range1-%myvar%
guicontrol ,,progbar, %myvar%/2 ;<--- does NOT show correctly (ends up NOT in the bar's ->MIDDLE)
guicontrol ,,progbar, %myvar%*9/10 ;<--- NOT near bar's end :/
pause

can replace the %myvar% in the 6th and 7th lines with absolute values (15 and 27) and this won't make any difference :?
btw using any value grater than 100 for myvar gives a even worst result
seems like the bar range is always being set as the default, 0-100 :/ MYVAR not being considered by the runtime :? :eh:
I appreciate any help

User avatar
neovis
Posts: 34
Joined: 12 Jun 2022, 03:56
Location: Republic of Korea
Contact:

Re: progress RANGE not working  Topic is solved

Post by neovis » 22 Jul 2022, 12:57

RangeN-N is a options
https://www.autohotkey.com/docs/commands/GuiControl.htm#options

Code: Select all

GuiControl +Range0-%myvar%, Progbar
Calculation should be an expression
https://www.autohotkey.com/docs/Language.htm#expressions-vs-legacy-syntax

Code: Select all

GuiControl,, Progbar, % myvar/2
GuiControl,, Progbar, % myvar*9/10

mewscwb
Posts: 14
Joined: 21 Jun 2022, 08:55

Re: progress RANGE not working

Post by mewscwb » 25 Jul 2022, 08:10

neovis wrote:
22 Jul 2022, 12:57
Thanks. Problem is that even using absolute numbers, progress ("+1" for instance) of this control is always a "percent" progress. So, why there'd have a range option?

For example, say:

Gui Add, Progress, w50 h20 cBlue backgroundyellow vProgbar ;<--- width = 50 pixels
GuiControl ,,progbar, range1-50 ;<--- every bar pixel should be a "unit" for the progress in such range "1-50"
Gui show
GuiControl ,,progbar, +50 ;<--- does not progress to the END of the bar but to its middle :/ :?

So it seems progress ("+") is always a "%" of the bar despite its range... if so, why there'd have such option "range"?

mewscwb
Posts: 14
Joined: 21 Jun 2022, 08:55

Re: progress RANGE not working

Post by mewscwb » 25 Jul 2022, 08:54

I've found that the example based on variables I've used for my previous example actually doesn't matter for the essence of the problem. The problem remains even if using absolute numbers in the range option. For instance:

Gui Add, Progress, w50 h20 cBlue backgroundyellow vProgbar ;<--- bar width = 50 pixels
GuiControl ,,progbar, range1-50 ;<--- in this case, each bar PIXEL should be a bar "unit" of its progress
Gui show
GuiControl ,,progbar, 50 ;<--- does not progress to the END of the bar, but to its middle ?!? :/ :?
GuiControl ,,progbar, 1
GuiControl ,,progbar, +25 ;<--- also does not progress to the bar's MIDDLE (since its range is 1-50) but to "a quarter" of the range

It seems indeed the number (or variable content) we pass to the positioning is never according to the range but is always a "percent" of the range...

so my question remains: why there has a range option for this control since we always have to use relative positioning ("%" of bar length), never can use absolute numbers for the positioning? :/

other: let's say you have 1000 lines of a text file to read into a var. If we set the range option to "0-1000"... we CAN'T use "+1" for progress of each line that was red. Because the value is "relative" to the bar range, not absolute in its range. We'd have to use a formula :/ to the progress value (in this example, it could be: #linesred/1000). Because "+1" in this example would mean TEN lines red (+1"%" of 1000) - not one line...

So, again, why there'd have an option for "ranges" since the value for the positioning seems is always "relative"/"%" to the bar lenght despite its range that was set..? :/

User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: progress RANGE not working

Post by boiler » 25 Jul 2022, 09:08

You’re wrong about it always being 1-100. Your GuiControl statement to set the range is not correct. You didn’t put stuff in the right parameters and didn’t use a + like neovis showed you, so you didn’t change the range.

mewscwb
Posts: 14
Joined: 21 Jun 2022, 08:55

Re: progress RANGE not working

Post by mewscwb » 25 Jul 2022, 09:32

boiler wrote:
25 Jul 2022, 09:08
You’re wrong about it always being 1-100. Your GuiControl statement to set the range is not correct. You didn’t put stuff in the right parameters and didn’t use a + like neovis showed you, so you didn’t change the range.
Hi Boiler, indeed I had missed the "+" before the Range option.
However the help didn't even mention this "+" in the sintaxe...:
Image

And then I tried adding this "+" before the Range keyword but result is the same:

Gui Add, Progress, w50 h20 cBlue backgroundyellow vProgbar ;<--- bar width = 50 pixels
GuiControl ,,progbar, +range1-50 ;<--- in this case each bar PIXEL should be the "unit" of such range
Gui show
GuiControl ,,progbar, 50 ;<--- does not progress to the END of the bar, but to its middle :/ :?

(yet about the "stuff" I'd have not put in the "right" parameters, I didn't get what it would mean)

User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: progress RANGE not working

Post by boiler » 25 Jul 2022, 10:36

mewscwb wrote: (yet about the "stuff" I'd have not put in the "right" parameters, I didn't get what it would mean)
I pointed you to neovis' example. It looks like you didn't even try to compare them.

neovis' example:

Code: Select all

GuiControl +Range0-%myvar%, Progbar
and what you did:

Code: Select all

GuiControl ,,progbar, +range1-50
I would hope that the differences are obvious. Everything else you typed in your last couple posts is moot since you have not even changed the range.

mewscwb
Posts: 14
Joined: 21 Jun 2022, 08:55

Re: progress RANGE not working

Post by mewscwb » 25 Jul 2022, 10:44

boiler wrote:
25 Jul 2022, 10:36
I wrote my last post and then tried to delete it butg it took time to be approved and show in the thread to me. In the meantime I realized what he had posted and what I was missing, and promptly marked his post as the answer. Then your post showed up right after.

Post Reply

Return to “Ask for Help (v1)”