Is there a smart way to do this simple number pattern? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
blad4
Posts: 315
Joined: 07 Oct 2015, 11:06

Is there a smart way to do this simple number pattern?

Post by blad4 » 07 Jun 2023, 19:30

When I add 6 to A (starting at 1), I want B (starting at 463) to increase by 1.

I've always done it like below... yes that's how much I cannot code. Just wondering if there's a better way

Code: Select all

if A=1
B=463
if A=7
B=464
if A=13
B=465
if A=19
B=466
if A=25
B=467

ntepa
Posts: 425
Joined: 19 Oct 2022, 20:52

Re: Is there a smart way to do this simple number pattern?

Post by ntepa » 07 Jun 2023, 19:50

maybe like this:

Code: Select all

MsgBox "A=1 B=" Convert(1)
MsgBox "A=7 B=" Convert(7)
MsgBox "A=13 B=" Convert(13)
MsgBox "A=19 B=" Convert(19)
MsgBox "A=25 B=" Convert(25)

Convert(num) {
    return 463 + (num // 6)
}

blad4
Posts: 315
Joined: 07 Oct 2015, 11:06

Re: Is there a smart way to do this simple number pattern?

Post by blad4 » 08 Jun 2023, 13:25

Thanks so much for the help. I have been trying to get it, is this function from python?

Could you help me in simplifying it this way:

Code: Select all

B=463+(%A%//6)
Because then I could send that, and it would give me the answer stored in B which I can then manipulate the other ways I need to?

ntepa
Posts: 425
Joined: 19 Oct 2022, 20:52

Re: Is there a smart way to do this simple number pattern?  Topic is solved

Post by ntepa » 08 Jun 2023, 13:54

is this function from python?
I made it up.

%% is not needed.

Code: Select all

A := 7
B := 463+(A// 6)

blad4
Posts: 315
Joined: 07 Oct 2015, 11:06

Re: Is there a smart way to do this simple number pattern?

Post by blad4 » 09 Jun 2023, 09:21

Perfect thank you

Post Reply

Return to “Ask for Help (v2)”