How to split a 6-digit number into 6 variables

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
hotlip1
Newbie
Posts: 2
Joined: Mon Jun 29, 2015 8:18 pm

How to split a 6-digit number into 6 variables

Post by hotlip1 » Mon Jun 29, 2015 8:29 pm

How do I do what the title says?

Then, depending on those 6 new variables, I need to find 6 images on the screen and click them. Say I call the 6 variables number1,2,...6
Would it be correct to replace the image path with %BMP_DIR%/%number1,2,...6%.bmp ?

Thanks

hagchr
Automation Wizard
Posts: 331
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: How to split a 6-digit number into 6 variables

Post by hagchr » Tue Jun 30, 2015 7:38 am

Using RegEx takes care of the first part (gives the digits as digit_1, digit_2, ...)

Code: Select all

Let>dig0=987654
RegEx>\d,dig0,0,digit,nm,0

Jerry Thomas
Macro Veteran
Posts: 267
Joined: Mon Sep 27, 2010 8:57 pm
Location: Seattle, WA

Re: How to split a 6-digit number into 6 variables

Post by Jerry Thomas » Tue Jun 30, 2015 5:17 pm

While RegEx is a very powerful tool, it is not an easy tool to learn.

I would suggest this code, while not nearly as elegant or efficient is much easier to actually read.
This just parses the numbers into the separate variables that you can use however you need.

Let>a=123456
MidStr>a,1,1,Variable1
MidStr>a,2,1,Variable2
MidStr>a,3,1,Variable3
MidStr>a,4,1,Variable4
MidStr>a,5,1,Variable5
MidStr>a,6,1,Variable6
Thanks,
Jerry

[email protected]

hotlip1
Newbie
Posts: 2
Joined: Mon Jun 29, 2015 8:18 pm

Re: How to split a 6-digit number into 6 variables

Post by hotlip1 » Wed Jul 01, 2015 12:09 pm

Thanks you, both codes worked perfectly.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts