Jump to content
Macro Express Forums

Random Variables


ecoast

Recommended Posts

Hello:

 

I have a ASCII file that I am processing (csv) in which the variables are input into fields (data entry work)

 

and of course i have variables assigned to the fields in which they are copied from the .csv and pasted as into the form fields.

 

Lets say variable T1 is a name goes into the NAME FIELD on the form.

 

But I want to assign T1, T2, and T3 as the name variables rather than just T1 and for the Macro to input any one of these into the NAME FIELD on the form at random.

 

Any ideas?

 

Thanks once again for your time!

 

Chris

Link to comment
Share on other sites

I'm sorry but I can't understand your post. You want T1-3 all to be the same variable? I'm not following you.

 

No, as of now my T1 variable goes into a particular form field, repetitvely. -- we'll just call this field "Name"

 

My T1 variable is the name

 

I have to added T2 and T3 variables into my csv making T1, T2, and T3 at this point..

 

all 3 of these variables contain a Name in my csv

 

instead of using only T1 as the Name variable to be input into the Name Field on the form, I want the Macro to select either T1, T2 or T3 at random to be input into the Name field.

 

Example:

 

1. Name Field = %T2%

2. Name Field = %T1%

3. Name Field = %T1%

4. Name Field = %T3%

5. Name Field = %T2%

 

i think i am over explaining it, its really a simple concept.

 

i have a repeating data entry process, in which the data entered into the repeated form is loaded from a .csv file

 

and instead of using the same variable each time for that one particular form field, i want to add 2 more variables (T2 & T3) and have the macro randomly choose only 1 of the 3 selected variables to be input into the particular form field.

 

make since now?

 

I have read up, and seen ways to use a random number to choose random lines from a text file to input, but i want to keep everything on the same csv file and choose randomly from there.

 

Thanks much for your time

 

Chris

Link to comment
Share on other sites

I'm still confused but I have a small brain so it's no wonder. <g> Can't you simply use the random number generating function to pick one? Variable Set Integer > Random.

 

 

??

 

I'm not looking for a number as a variable..

 

this a example is purely for example sake.

 

i have an online form with many fields that I am filling our online. the information that will go into the forms are contained in a comma separated text file, which happens to be an Excel csv file.

 

for example, lets say I have 5 fields.

 

the 1st field is for a Name the 2nd field is for some thing age, the 3rd is for something else the ... so on and so on..

 

the csv file loads every time the form filling starts at field 1 (Name Field).. and every time the form filling starts it loads the variables again but moves to the next row in the csv..

 

row A of the csv is T1 row 2 of the csv is T2 so on and so on

 

each field in the form is assigned a variable and the variable is derived from the csv file..

 

I want T1 T2 and T3 to be names in the csv, (the names are already filled in csv) and currently the form takes the name from the T1 variable in the csv and puts it in the Name field of the form

 

I want to assign the Name field a random value of T1 T2 or T3 how do i do it

 

HERE IS HOW THE FILE IS NOW, and work great!

 

before.jpg

 

 

THIS IS THE FILE FORMAT I WANT TO USE

 

after.jpg

 

 

The Macro will RANDOMLY choose one of the names from each line in -- other words it will randomly choose T1, T2, or T3 and assign it to the Name Filed in the form..

 

I tried to be as illustrative as possible..

 

 

here is the current command text

 

Variable Set Integer %N1% from Prompt

Variable Modify Integer: %N1% = %N1% - 1

Repeat Prompt Start (Prompt for repeat count at macro play time)

Variable Modify Integer: %N1% = %N1% + 1

 

// HERE IS WHERE WE LOAD "T" VARIABLES

ASCII File Begin Process: "form_file.csv" (Comma Delimited Text )

ASCII File End Process

Web Site: www.whatever.com [internet Explorer - Wait to load]

Window Maximize: Current Window

Wait For Window Title: "form page"

Delay 1 Seconds

// TYPE OUT NAME

Text Type: %T1%<TAB>

Delay 1 Seconds

// TYPE OUT AGE

Text Type: %T2%<TAB>

Delay 1 Seconds

// TYPE JOB TITLE

Text Type: %T3%<TAB>

///////////////////////////////////////////////

 

 

THIS IS WHAT I WANT

 

Variable Set Integer %N1% from Prompt

Variable Modify Integer: %N1% = %N1% - 1

Repeat Prompt Start (Prompt for repeat count at macro play time)

Variable Modify Integer: %N1% = %N1% + 1

 

// HERE IS WHERE WE LOAD "T" VARIABLES

ASCII File Begin Process: "form_file.csv" (Comma Delimited Text )

ASCII File End Process

Web Site: www.whatever.com [internet Explorer - Wait to load]

Window Maximize: Current Window

Wait For Window Title: "form page"

Delay 1 Seconds

// TYPE OUT NAME

Text Type: %T1% OR %T2% OR %T3% (<<-- **RANDOMLY CHOOSE**) <TAB>

Delay 1 Seconds

// TYPE OUT AGE

Text Type: %T4%<TAB>

Delay 1 Seconds

// TYPE JOB TITLE

Text Type: %T5%<TAB>

 

T1 is already my variable I use for my names as you can see...

 

I want to modify and make T2 and T3 variable for names too

 

i know i would have to bump the current T2 and T3 variables up a number but that is besides the point..

 

Once I fill the T2 and T3 fields with names.. i want the Macro to randomly choose T1 or T2 or T3 to be used to fill in the name field of my form..

 

\\\\\\\\\\\\\\\\\\\

 

ok thats as descriptive as i can be..

 

keep in mind this form filling scenario with names and age job description i just made up for a example..

 

 

 

THANK YOU

 

Chris

Link to comment
Share on other sites

??

 

I'm not looking for a number as a variable..

 

this a example is purely for example sake.

 

i have an online form with many fields that I am filling our online. the information that will go into the forms are contained in a comma separated text file, which happens to be an Excel csv file.

 

for example, lets say I have 5 fields.

 

the 1st field is for a Name the 2nd field is for some thing age, the 3rd is for something else the ... so on and so on..

 

the csv file loads every time the form filling starts at field 1 (Name Field).. and every time the form filling starts it loads the variables again but moves to the next row in the csv..

 

row A of the csv is T1 row 2 of the csv is T2 so on and so on

 

each field in the form is assigned a variable and the variable is derived from the csv file..

 

I want T1 T2 and T3 to be names in the csv, (the names are already filled in csv) and currently the form takes the name from the T1 variable in the csv and puts it in the Name field of the form

 

I want to assign the Name field a random value of T1 T2 or T3 how do i do it

 

HERE IS HOW THE FILE IS NOW, and work great!

 

before.jpg

THIS IS THE FILE FORMAT I WANT TO USE

 

after.jpg

The Macro will RANDOMLY choose one of the names from each line in -- other words it will randomly choose T1, T2, or T3 and assign it to the Name Filed in the form..

 

I tried to be as illustrative as possible..

here is the current command text

 

Variable Set Integer %N1% from Prompt

Variable Modify Integer: %N1% = %N1% - 1

Repeat Prompt Start (Prompt for repeat count at macro play time)

Variable Modify Integer: %N1% = %N1% + 1

 

// HERE IS WHERE WE LOAD "T" VARIABLES

ASCII File Begin Process: "form_file.csv" (Comma Delimited Text )

ASCII File End Process

Web Site: www.whatever.com [internet Explorer - Wait to load]

Window Maximize: Current Window

Wait For Window Title: "form page"

Delay 1 Seconds

// TYPE OUT NAME

Text Type: %T1%<TAB>

Delay 1 Seconds

// TYPE OUT AGE

Text Type: %T2%<TAB>

Delay 1 Seconds

// TYPE JOB TITLE

Text Type: %T3%<TAB>

///////////////////////////////////////////////

THIS IS WHAT I WANT

 

Variable Set Integer %N1% from Prompt

Variable Modify Integer: %N1% = %N1% - 1

Repeat Prompt Start (Prompt for repeat count at macro play time)

Variable Modify Integer: %N1% = %N1% + 1

 

// HERE IS WHERE WE LOAD "T" VARIABLES

ASCII File Begin Process: "form_file.csv" (Comma Delimited Text )

ASCII File End Process

Web Site: www.whatever.com [internet Explorer - Wait to load]

Window Maximize: Current Window

Wait For Window Title: "form page"

Delay 1 Seconds

// TYPE OUT NAME

Text Type: %T1% OR %T2% OR %T3% (<<-- **RANDOMLY CHOOSE**) <TAB>

Delay 1 Seconds

// TYPE OUT AGE

Text Type: %T4%<TAB>

Delay 1 Seconds

// TYPE JOB TITLE

Text Type: %T5%<TAB>

 

T1 is already my variable I use for my names as you can see...

 

I want to modify and make T2 and T3 variable for names too

 

i know i would have to bump the current T2 and T3 variables up a number but that is besides the point..

 

Once I fill the T2 and T3 fields with names.. i want the Macro to randomly choose T1 or T2 or T3 to be used to fill in the name field of my form..

 

\\\\\\\\\\\\\\\\\\\

 

ok thats as descriptive as i can be..

 

keep in mind this form filling scenario with names and age job description i just made up for a example..

THANK YOU

 

Chris

 

 

Text Type: %T1% OR %T2% OR %T3% (<<-- **RANDOMLY CHOOSE**) <TAB>

 

This is how I'd accomplish this.

 

Set Integer N90 random, 0-2.

 

If variable N90=0

Text type T1

End if

If variable N90=1

Text type T2

End if

If variable N90=2

Text type T3

End if

 

 

But I'm a psycho for logic commands, so it could just be me.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...