Imacros extraction - imacros

I just started using Imacros,so far so good. I'm attempting to scrap large amounts of information from tables and then delimit it in excel. However when I try and do so i'm told the info is all ready delimited. Any ideas how I can brake this information up or how it's being imported into excel? The extracted info appears in one cell as a long string with long spaces in between? I bow down to anyone who can solve this problem!
VERSION BUILD=7300701 RECORDER=FX
TAB T=1
SET !DATASOURCE 130.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !EXTRACT_TEST_POPUP NO
URL GOTO=http://www.autohausaz.com/index.html
SET !ERRORIGNORE YES
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchkeyword ATTR=ID:topsearchbox CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:IMAGE FORM=NAME:searchkeyword ATTR=NAME:searchbutton&&SRC:http://www.autohausaz.com/assets/images/topsearchbutton.gif
TAG POS=1 TYPE=TABLE ATTR=ID:dlGroups
TAG POS=3 TYPE=TD ATTR=TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=brake.csv

A good way to extract data is using scripting interface. This is how you do it.
var macro;
macro ="CODE:";
macro +="TAG POS=1 TYPE=SOMEELEMENT ATTR=CLASS:someclass EXTRACT=TXT"+"\n";
iimPlay(macro)
var extractedtext=iimGetLastExtract();
The way to save data into a file is something else. This is a good thread that deals about that on iopus forum . saving data into file
iMacros forum is ok for searching the examples you want but people working on that forum are very slow in responses so you could wait too long for an answer or not get it at all. My advice is to use google and type "imacros" + what every you are searching for or simply look on their wiki page . iMacros Wiki

You can use EVAL to delimit the data if it is in constant format.
I see the tabular format of data, I think you want to scrape all of the data, I will suggest you make a javascript for this.
You can use the relative tag to get data of adjacent column into your CSV.
TAG POS=R1 TYPE=SPAN ATTR=* EXTRACT=TXT

Related

How to Make iMacros Run Data Entry Script for 100's of CSV's?

I have a script that will run the same exact process (pasting a list from a CSV into a text box), many times on the same web page, and I'm trying to get it to run the process one time for many CSV's in the working folder (1.csv, 2.csv, 3.csv,... 100.csv, etc).
Is it possible for iMacros to loop through the same script, only varying the input file (!DATASOURCE)?
I will name the CSV's numerically so the script can cycle through them easily.
Link to sample CSV (note: all keywords put into 1 cell so that it can be pasted as a list, one per line).
Example of how each CSV file's contents will be pasted as a list (one keyword per line):
I am new to iMacros and was hoping this would work, but it stops running on the 2nd loop, and throws the error:
TypeError: this.dataSource[(line - 1)] is undefined, line 14 (Error code: -1001)
Here is the code I have so far:
VERSION BUILD=8961227 RECORDER=FX
TAB T=1
SET !DATASOURCE {{!LOOP}}.csv
URL GOTO=https://sellercentral.amazon.com/hz/cm/adgroup/create?campaignId=A0478490D2AQYA9C8NTW
TAG POS=1 TYPE=DIV ATTR=ID:product-search-results
TAG POS=1 TYPE=INPUT:SEARCH FORM=ID:form-ad-group ATTR=ID:product-search-input CONTENT=product<SP>name
TAG POS=1 TYPE=BUTTON FORM=ID:form-ad-group ATTR=ID:product-search-button
TAG POS=1 TYPE=BUTTON FORM=ID:form-ad-group ATTR=TXT:Select
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-ad-group ATTR=ID:txt-starting-bid CONTENT=1.25
TAG POS=1 TYPE=A ATTR=ID:tool-kw-ui-manual
TAG POS=1 TYPE=TEXTAREA FORM=ID:form-ad-group ATTR=ID:txt-keywords CONTENT={{!COL1}}
TAG POS=1 TYPE=DIV ATTR=TXT:Add<SP>these<SP>keywordsSaving...
Note:
I'm trying to automate data entry of a list, and since the data needed to be pasted one keyword per line, I had to save my list with notepad as a .csv and put quotation marks before the first keyword, and after the last keyword, so iMacros would recognize it as just 1 cell.
Just realized my approach was valid, just didn't realize I had to put the SET !DATASOURCE_LINE 1 after SET !DATASOURCE {{!LOOP}}.csv
The working code I have now looks like this:
VERSION BUILD=8961227 RECORDER=FX
TAB T=1
SET !DATASOURCE {{!LOOP}}.csv
SET !DATASOURCE_LINE 1
URL GOTO=https://sellercentral.amazon.com/hz/cm/adgroup/create?campaignId=A0478490D2AQYA9C8NTW
TAG POS=1 TYPE=DIV ATTR=ID:product-search-results
TAG POS=1 TYPE=INPUT:SEARCH FORM=ID:form-ad-group ATTR=ID:product-search-input CONTENT=product<SP>name
TAG POS=1 TYPE=BUTTON FORM=ID:form-ad-group ATTR=ID:product-search-button
TAG POS=1 TYPE=BUTTON FORM=ID:form-ad-group ATTR=TXT:Select
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-ad-group ATTR=ID:txt-starting-bid CONTENT=1.25
TAG POS=1 TYPE=A ATTR=ID:tool-kw-ui-manual
TAG POS=1 TYPE=TEXTAREA FORM=ID:form-ad-group ATTR=ID:txt-keywords CONTENT={{!COL1}}
TAG POS=1 TYPE=DIV ATTR=TXT:Add<SP>these<SP>keywordsSaving...

Imacros script extract and save to csv

I'm new to imacros and am having a little trouble figuring out this script. Here is my imacros script
VERSION BUILD=8920312 RECORDER=FX
TAB T=1
SET !DATASOURCE input.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=https://URL.com/Property/Search
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/Property/Search ATTR=ID:PropertyAddress CONTENT={{!COL1}}
TAG POS=1 TYPE=BUTTON FORM=ACTION:/Property/Search ATTR=ID:btnSearchSubmit
WAIT SECONDS=10
TAG POS=1 TYPE=TD ATTR=TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\admin\Documents\iMacros\Downloads FILE=extract.csv`
The input.csv has a list of addresses. That part works fine.
The part I'm having trouble with is extracting text. Here is the code from the page with the text I want to extract:
<td colspan="5" class="style2">
TEXT TO EXTRACT
</td>
I have the extract.csv in the downloads folder so I don't think that's an issue. The script seems to run fine except for it's not extracting the text. The text extraction popup is just blank.
I'm also having trouble determining the best way to save the extracted the data. All of the data in the input.csv is addresses and they're all in column 1. Some of them will not return any results when submitted.
Ideally, when saving the extracted data I'd like to save both the address pulled from the {{!COL1}} variable and the extracted data to the same row in the extract.csv spread sheet with the address and extracted data being in separate columns.
Hope I explained that well enough. Thanks in advance for any pointers!
The second part of your question can be solved simply by adding one line after WAIT SECONDS=10 :
SET !EXTRACT {{!COL1}} .
The issue as to extraction seems to lie in a wrong TYPE=TD (or just in absence of any text, if ‘iMacros’ doesn’t return the ‘#EANF#’ value). Try to record again a click on the element you want to extract text from and compare the obtained command with your TAG POS=1 TYPE=TD ATTR=TXT:* EXTRACT=TXT .
Anyway you might test for example:
TAG POS=1 TYPE=TD ATTR=COLSPAN:5&&CLASS:style2 EXTRACT=TXT .

Imacros how to make wilcard?

I am beginning user of imacros for firefox,
I have all updated, and tried to record this macro to load next page.
In one instance next page link is:
TAG POS=1, in another TAG POS=2.
I tried to use wildcard * instead of number 1 or 2, but didn't work.
What is a way to make wildcard, so imacros can click the link regardless is it TAG POS=1 or TAG POS=2?
Probably, this could help you (but without a wildcard):
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
TAG POS=1 ...
TAG POS=2 ...
SET !ERRORIGNORE NO
SET !TIMEOUT_STEP 6
This is possible.
Use a different identifier for what iMacros needs to click on:
TAG POS=1 TYPE=A ATTR=TXT:Button*
Explanation from documentation:
Tag line as recorded by iMacros:
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/kb/ki.dll/ke.kb.gz?kbb;532452&&2&&&&&nc ATTR=NAME:zipcode CONTENT=85250
If you record the same macro a second time you will see that we get the same TAG line except one number - this is the session ID the website is using.
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/kb/ki.dll/ke.kb.gz?kbb;532244&&2&&&&&nc ATTR=NAME:zipcode CONTENT=85250
Replace the session ID with *:
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/kb/ki.dll/ke.kb.gz?kbb;*&&2&&&&&nc ATTR=NAME:zipcode CONTENT=85250
Actually, you could also remove most or all of the static parts of the FORM information as well. Exactly how much you can remove depends on the website. You still need enough information for iMacros to uniquely identify the page element. In our example, the result looks like:
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/kb/* ATTR=NAME:zipcode CONTENT=85250
or even
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:* ATTR=NAME:zipcode CONTENT=85250
Note: TXT:* is not the same as TXT: (without ). If only TXT: is used, this means you are looking for an element where the text attribute is "", if you are using TXT: this means that the text attribute can have any value (= same as omitting the text attribute altogether). This applies to any attribute, not just TXT.
Sources:
http://wiki.imacros.net/Form_Filling#Wildcards
http://forum.imacros.net/viewtopic.php?t=11663

iMacros loop based search and extract result

I am trying to build a macro that automatically search a Keyword from a CSV file and paste it in a search box then click on search button, when search result comes up then click on that result.So far I can go maximum click on search button and bring search result but I can't do later. Now What command should I put that macro so it clicks on the search result. Please see below images
Below is the code I am using:
VERSION BUILD=8810214 RECORDER=FX
TAB T=1
SET !DATASOURCE Extracts.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET !Extract_TEST_POPUP NO
URL GOTO=https://reports.zoho.com/ZDBDataSheetView.cc?DBID=302139000000984683
TAG POS=1 TYPE=DIV ATTR=ID:ZDBMainBox
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:ZDBObjSearchTxtFld CONTENT= {{!COL1}}
wait seconds = 3
TAG POS=131 TYPE=DIV ATTR=TXT:
TAG POS=1 TYPE=A ATTR=ID:{{!COL1}}
Can anyone please help me to figure out the right command?
VERSION BUILD=8810214 RECORDER=FX
TAB T=1
SET !DATASOURCE Extracts.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET !Extract_TEST_POPUP NO
URL GOTO=https://reports.zoho.com/ZDBDataSheetView.cc?DBID=302139000000984683
TAG POS=1 TYPE=DIV ATTR=ID:ZDBMainBox
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:ZDBObjSearchTxtFld CONTENT={{!COL1}}
wait seconds = 3
TAG POS=131 TYPE=DIV ATTR=TXT:
TAG POS=1 TYPE=A ATTR=TXT:*{{!COL1}}*
I tried this code and it worked. I replaced the ID with TXT in last line of the code.

iMacro, how to set variables from selected text?

It's a framed site, and the TAG command created when I highlight the text is:
FRAME F=0
TAG POS=1 TYPE=A ATTR=TXT:TEST<SP>TEST
I'm trying to figure out how to extract the TEST<SP>TEST part and set it to a variable, so I can put it in a form on another tab.
try this:
FRAME F=0
TAG POS=1 TYPE=A ATTR=TXT:TESTTEST extract=txt