Recommended Posts

Hi all brilliant,

i stuck with 2 things.

1. I need to random 4 number start 1111 - 9999. i use random(1111,9999,0) but result did not give me INTEGER number. Thus how i want only interger number start from 1111 - 9999.

2. How i want to read only 4 number at the middle of 8 number like this:

i need read number only 3456 from 12345678

I know it's nut for u all but not for me. Tq for your help. i so appreciate it

Share on other sites

```\$Num = Random(1111, 9999, 1)
MsgBox(0, 'Number', \$Num)

\$String = 12345678
\$Middle = StringTrimLeft(StringTrimRight(\$String, 2), 2)
MsgBox(0, 'Middle', \$Middle)```

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share on other sites

1

use random(1111,9999,1) ; notice the "1"

2

```\$String = "12345678"
\$Result = StringTrimLeft(\$String, 2)
\$Final = StringLeft(\$Result, 4)
MsgBox(64, "test", \$Final)```

8)

getting slower everyday... lol

Edited by Valuater

Share on other sites

getting slower everyday... lol

Comes with age

Edit:

Just thought I'd throw another in the mix:

```\$String = Random(11111111, 99999999, 1)
\$Middle = StringMid(\$String, 3, 4)
MsgBox(0, 'Middle', \$String & @CR & \$Middle)```
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Create an account

Register a new account