Need Help Shortening This Macro

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
User avatar
322126384
Posts: 32
Joined: Sat Jul 23, 2011 1:39 am

Need Help Shortening This Macro

Post by 322126384 » Mon Aug 01, 2011 12:17 am

i have this macro that is about 200 lines long. what it does is clicks on a link, then searches for certain keywords (via TAG command) if found the macro errors, but if not found then clicks on a different link and repeats the search for the same keywords. here is the format of it:

Code: Select all

URL GOTO=http://example.com
TAG POS=1 TYPE=* ATTR=TXT:*1* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*2* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*3* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*4* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*5* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*6* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*7* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*8* CONTENT=EVENT:FAIL_IF_FOUND
URL GOTO=http://example2.com
TAG POS=1 TYPE=* ATTR=TXT:*1* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*2* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*3* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*4* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*5* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*6* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*7* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*8* CONTENT=EVENT:FAIL_IF_FOUND
URL GOTO=http://example3.com
TAG POS=1 TYPE=* ATTR=TXT:*1* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*2* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*3* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*4* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*5* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*6* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*7* CONTENT=EVENT:FAIL_IF_FOUND
TAG POS=1 TYPE=* ATTR=TXT:*8* CONTENT=EVENT:FAIL_IF_FOUND
What i want is that looking for the keywords 1-8 are all in one TAG command. Is this possible? or do i have to use a scripting interface?
-322126384
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: Need Help Shortening This Macro

Post by MattBell7 » Mon Aug 01, 2011 8:25 am

best i can do without the scripting interface:
note, this is untested, may need tweaking to work for you.

Code: Select all

SET !ERRORIGNORE YES
SEARCH SOURCE=REGEXP:"([1-8])" EXTRACT=$1
SET !ERRORIGNORE NO
TAG POS=1 TYPE=* ATTR=TXT:*{{!EXTRACT}}* CONTENT=EVENT:FAIL_IF_FOUND
User avatar
322126384
Posts: 32
Joined: Sat Jul 23, 2011 1:39 am

Re: Need Help Shortening This Macro

Post by 322126384 » Wed Aug 03, 2011 5:49 pm

MattBell7 wrote:best i can do without the scripting interface:
note, this is untested, may need tweaking to work for you.

Code: Select all

SET !ERRORIGNORE YES
SEARCH SOURCE=REGEXP:"([1-8])" EXTRACT=$1
SET !ERRORIGNORE NO
TAG POS=1 TYPE=* ATTR=TXT:*{{!EXTRACT}}* CONTENT=EVENT:FAIL_IF_FOUND
How would this work if i was looking for the different words like car, boat, plane, train. is it possible or do i need to use the scripting interface.
-322126384
Post Reply