Need more than 3 variables

Information related to the use of iMacros for form filling and data upload.

Moderator: iMacros Moderators

Need more than 3 variables

by Tech Support on Mon Mar 19, 2007 7:32 am

Q: I use the PROMPT command in my macro for user input. However, I need to assign more than three variables.

A: The problem is that iMacros PROMPT command can only set the three variables !VAR1, !VAR2 and !VAR3. If more then three pieces of user input are needed you simply run out of variables. The solution is to take the user input step by step.

First, let the macro navigate to the site where the input is needed. Then use the PROMPT command to ask for the first three inputs and fill the webform with these three pieces of information using the TAG command.

Now the variables are free to be used with the PROMPT command again since the input has already been given to the website. You can continue with this procedure until you have filled the entire form.

iOpus Support
User avatar
Tech Support
 
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm

Re: Need more than 3 variables

by Topdogie01 on Sun Jun 22, 2008 10:50 pm

Yes this works, but what if we would like to loop and call back the original variable that was set before we changed it for the 4th variable? is there a way we could use another included variable?
Topdogie01
 
Posts: 4
Joined: Sun Jun 22, 2008 10:25 pm

Re: Need more than 3 variables

by Tech Support on Fri Jun 27, 2008 2:22 pm

Topdogie01, do you have an example for such a task?
User avatar
Tech Support
 
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm

Re: Need more than 3 variables

by Topdogie01 on Sat Jun 28, 2008 12:38 am

[code]
VERSION BUILD=5220125
TAB T=1
URL GOTO=http://website.com
PROMPT Please<SP>Enter<SP>The<SP>Name<SP>For<SP>Email<SP>To<SP>Be<SP>Used !VAR1
PROMPT Please<SP>Enter<SP>The<SP>First<SP>Name !VAR2
PROMPT Please<SP>Enter<SP>The<SP>Last<SP>Name !VAR3
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=NAME:Email CONTENT={{!VAR1}}@service.com
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=NAME:ConfirmEmail CONTENT={{!VAR1}}@service.com
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:aspnetForm ATTR=NAME:Password CONTENT=aaaaa1
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:aspnetForm ATTR=NAME:ConfirmPassword CONTENT=aaaaa1
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=NAME:FirstName CONTENT={{!VAR2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=NAME:LastName CONTENT={{!VAR3}}
TAG POS=1 TYPE=SELECT FORM=NAME:aspnetForm ATTR=NAME:Regions CONTENT=5
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=NAME:PostalCode CONTENT=90210
TAG POS=1 TYPE=SELECT FORM=NAME:aspnetForm ATTR=NAME:Month CONTENT=7
TAG POS=1 TYPE=SELECT FORM=NAME:aspnetForm ATTR=NAME:Day CONTENT=4
TAG POS=1 TYPE=SELECT FORM=NAME:aspnetForm ATTR=NAME:Year CONTENT=33
TAG POS=1 TYPE=INPUT:RADIO FORM=NAME:aspnetForm ATTR=NAME:gender&&VALUE:F CONTENT=F
PROMPT Please<SP>Type<SP>The<SP>Text<SP>In<SP>The<SP>Image !VAR4
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=NAME:ctl00$cpMain$Captcha$CaptchaControl$captchaResponseTextBox CONTENT={{!VAR4}}
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:aspnetForm ATTR=ID:Terms CONTENT=YES
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:aspnetForm ATTR=NAME:ctl00$cpMain$Submit$SubmitButton&&VALUE:Sign<SP>Up
[/code]

that is the code im running. is there a way i can get a 4th variable, or possibly combine variable 2 and 3 and have imacros separate the first part of the variable and 2nd part? or is there another variable that i can set for the captcha from the user input? and is there a way i can make it loop back to the beginning? give it a GOTO command?
Topdogie01
 
Posts: 4
Joined: Sun Jun 22, 2008 10:25 pm

Re: Need more than 3 variables

by bsmyth292 on Fri Oct 24, 2008 1:18 am

Yes, having only three user-defined variables seems to be a limitation. For example, I'm trying to create a macro that gathers first name, middle name, last name, and business address for a person. When the user hits return, iMacros opens up multiple tabs, each which direct to a different search site, and they all search for these four variables at the same time.

This would be a great timesaver, but I only have three variables to work with, so I can't do this. One would think that the middle name variable not so important and so might be dropped and the variable used for address data. However, the middle name is very important to distinguish, for example, Tom A. Smith from Tom B. Smith with common names.

The recommended technique of visiting a page to dump the three variables before acquiring new user input doesn't really work in this case, because what we are trying to do is input once, search many sites simultaneously. Again, that's what would save us a lot of time and work.

I'm thinking that some kind of workaround to this might be to somehow, on a local HTTP server, create an HTML "target" page that has fields for each of these four inputs which form URLs to the search sites I want to visit. I visit this page from within iMacros and after the initial submit button is clicked, iMacros takes it from there, scraping the info I need from the results of each search. I'm not sure how this would play out in practice, however. I'll have to play around before I know if this will work.
bsmyth292
 
Posts: 0
Joined: Fri Oct 24, 2008 1:03 am

Re: Need more than 3 variables

by artb on Tue Oct 13, 2009 6:40 am

Here's a couple workarounds to the problem:
1)
The EXTRACT command is itself a 4th variable.
EXTRACT can be used for content, too
CONTENT={{!VAR1}}
CONTENT={{!VAR2}}
CONTENT={{!VAR3}}
CONTENT={{!EXTRACT}}

2)
For limitless use of variables, use tabs.
Data scrape and SET the first 4 variables from the source web page on the first Tab.
Then, open the destination form in a new Tab
TAB OPEN
URL GOTO:http://www.your_destination_form.com
TAB T=2
use up the variables, set them NULL, then switch back to the first tab and scrape more data
TAB= 1
This tells imacros to go back and forth scraping and depositing data until your done.
artb
 
Posts: 3
Joined: Tue Aug 11, 2009 9:50 am


Return to How-To's and Examples for Form Filling

Who is online

Users browsing this forum: No registered users and 2 guests

-->