iMacros to extract google Link - imacros

I have a query in imacro
I have this code
SET !TIMEOUT_STEP 0
SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE YES
SET !DATASOURCE GoogleExtract.csv
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=https://www.google.com/?gws_rd=ssl
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT={{!COL1}}
TAG POS=1 TYPE=BUTTON:SUBMIT FORM=NAME:f ATTR=NAME:btnG
WAIT SECONDS=10
TAG POS=1 TYPE=H3 ATTR=CLASS:"r" EXTRACT=HTM
SET !EXTRACT EVAL("'{{!EXTRACT}}'.match(/a href=\"(.*)\" onmousedown=/)[1];")
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Chirag_Guru99\Documents\iMacros\Datasources FILE=GoogleExtractLinks.csv
I want to extract all google search results links in one excel file
But right now
I have code which extract only first link

Related

How to change "SAS Output" in web-browser tab with ODS HTML command?

I output the results to HTML using a command like this:
proc import out=DATASET
datafile="DATASET.csv"
dbms=csv replace;
run;
ods html body='html_page.htm' style=HTMLBlue;
proc means data=teeth ;
run;
ods html close;
When I view html_page.htm in a web-browser, the tab is labeled "SAS Output". If I look at the source code of html_page.htm I see that this is under the tag <TITLE> SAS Output </TITLE>. So I tried the following command but it didn't work:
ods html title=`NEW TAB TITLE` body='html_page.htm' style=HTMLBlue;
proc means data=teeth ;
run;
ods html close;
How can I change the tab title with and ODS HTML command?
Specify the page title in the sub-options of ODS HTML BODY option.
ods html body='html_page.htm'(title="My Title") style=HTMLBlue;

Calling more than 1 SET! LOOP, imacros

hello I use this code to fill from CSV , imacros in firefox .
Hello , I'm using this code in imacros to draw 1 line of CSV and fill 1 website form.
VERSION BUILD=8530828 RECORDER=FX
SET !ERRORIGNORE YES
SET !DATASOURCE C:\22853.csv
SET !DATASOURCE_COLUMNS 1
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=http://www.publianuncia.com/site/crearAnuncioMundoanuncio/22853
TAG POS=1 TYPE=SPAN ATTR=ID:titulo-22853
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:titulo-22853-inplaceeditor ATTR=NAME:value CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:titulo-22853-inplaceeditor ATTR=*
I call the first line of the CSV , to fill a web form.
what I want now and I can not do this, you call more than 1 line of CSV , to fill a web form.
I have 6 lines in the CSV and want to call 6 to fill only 1 web form.
Thank you
Multiply code or Play (LOOP) with MAX: 6

SAS insert text into email body

This is the original code.
filename outmail email type='text/html'
subject='see this'
from="..."
to="..."
attach=("\...\a.pdf"content_type="application/pdf");
ods _all_ close;
ods listing close;
ods html body=outmail style=minimal;
title1 'AAA';
title2 'BBB';
proc tabulate data=
...
run;
ods html close;
ods listing;
But now I don't want to show a tabulated output in the email body, so I remove this part from the original code.
proc tabulate data=
...
run;
The problem is I won't have titles in the email any more. It seems I have to put some proc in the code to make titles exist in the email. But I don't want to show anything in the email body except
Hi all,
Regards,
Balala
Update
I tried this but no luck.
filename outmail email type='text'
subject="AAAA"
from="..."
to="..."
attach=("\\...\text.pdf" content_type="application/pdf");
data _null_;
file outmail;
put 'Hi all,';
put 'First line';
put 'Second line ';
put ' ';
put 'Regards,';
put 'Balala';
run;
But in the email, it shows Hi all,First lineSecond line Regards,Balala.
Update2
The 2nd option doesn't work for me.
1st option doesn't work at first, but when I restart SAS session, it works. But I haven't changed any setting.
And interestingly, I change the type to text/plain instead of text or text/html then everything works fine
You have two options there.
Options 1: HTML tags
Specify HTML tags in your email if you are doing content_type="text/html"
Example:
filename mailbox email 'me#example.com' subject='test email' content_type="text/html";
data _null_;
file mailbox;
put "<body>";
put "<p>Hello,</p>" ;
put "<p>Test email sent <br> Regards,</p>" /
'Automated SAS Code';
put "</body>";
RUN;
Options 2 "Backslash" pointer:
Specify backslash at the end of the line to make the pointer to go over the line. Beware of what Quentin pointed in the comments, you could end up with double lines. Depends on the your SAS platform and email server. Documented here (search for in the document "/"): http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000161869.htm
filename mailbox email 'me#example.com' subject='test email';
data _null_;
file mailbox;
put "Hello," /;
put "Test email sent. "/;
put "Regards," /;
put "Automated SAS Code";
RUN;
Regards,
Vasilij

Using iMacros to extract multiple combinations of a form to a CSV file

I'm brand new to iMacros, but I found the tool for a very specific use. However, I'm having trouble where to start..I think I'm a bit overwhelmed. Below is what I'd like to do, and I'll annotate it in English to explain the tasks, that I believe should be easy with the software..Any help in the right direction would be wonderful.
There are a lot of similar questions but like I said I'm brand new to the software and I imagine this should be straight-forward. Thanks!
VERSION BUILD=9002379
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.designashirt.com/QuickQuote.aspx
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:listCategory CONTENT=%5
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:listType CONTENT=%27
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:listProduct CONTENT=%31
TAG POS=1 TYPE=INPUT:IMAGE FORM=ACTION:QuickQuote.aspx ATTR=NAME:rptColors$ctl00$imgColorSwatch
'listFrontColors should cycle from 1 - 7
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:listFrontColors CONTENT=%1
'listBackColors should cycle from 0 - 7
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:listBackColors CONTENT=%0
TAG POS=1 TYPE=DIV FORM=ACTION:QuickQuote.aspx ATTR=ID:step3
'This input field should cycle from 6 - 300
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:QuickQuote.aspx ATTR=NAME:rptAdultSizes$ctl02$sizeBox$txtQuantity CONTENT=6
TAG POS=1 TYPE=DIV FORM=ACTION:QuickQuote.aspx ATTR=TXT:Hanes<SP>Tagless<SP>Tee<SP>DescriptionIt<SP>is<SP>easy<SP>to<SP>understand<SP>why<SP>Hanes<SP>is<SP>a<SP>go-to<SP>bran*
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:ddPrintType CONTENT=%SCRN
'This field is what needs to be extracted to a CSV file along with the listFrontColors & listBackColors & txtQuantity. example:
' Front Back Price
'6 1 0 $15.94
'7 1 0 $15.xx
'...
'300 1 0 $xx.xx
TAG POS=1 TYPE=TD FORM=ACTION:QuickQuote.aspx ATTR=TXT:$15.94
So far, I have:
VERSION BUILD=9002379
TAB T=1
TAB CLOSEALLOTHERS
SET VAR1 {{LOOP1}}
ADD VAR1 +1
URL GOTO=http://www.designashirt.com/QuickQuote.aspx
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:listCategory CONTENT=%5
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:listType CONTENT=%27
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:listProduct CONTENT=%31
TAG POS=1 TYPE=INPUT:IMAGE FORM=ACTION:QuickQuote.aspx ATTR=NAME:rptColors$ctl00$imgColorSwatch
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:listFrontColors CONTENT=%1
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:QuickQuote.aspx ATTR=NAME:rptAdultSizes$ctl02$sizeBox$txtQuantity CONTENT={{!LOOP}}
TAG POS=1 TYPE=SELECT FORM=ACTION:QuickQuote.aspx ATTR=NAME:ddPrintType CONTENT=%SCRN
'POS=1 TYPE=TD FORM=ACTION:QuickQuote.aspx ATTR=TXT:$15.94
TAG POS=1 TYPE=DIV FORM=ACTION:QuickQuote.aspx ATTR=ID:quick-quote
TAG POS=17 TYPE=TD FORM=ACTION:QuickQuote.aspx ATTR=* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Jeff\ FILE=test.csv
Currently the output looks like this:
$0.00
$0.00
$0.00
$0.00
$0.00
$15.94
$14.59
$13.58
$12.80
$12.17
$11.66
$0.00
$0.00
$0.00
I'm not sure why this breaks where 12 would be the number, but it does. If I can't automate the rest, I'd be fine with just editing this script and doing it ~90 times, still way easier, but not ideal.

How to restore the default html output destination in SAS?

This must be so simple, but I can't find it:
How do you restore the default output destination in SAS 9.3?
Unlike 9.2, that is HTML.
In other words, which commands voids this statement.
ods html close;
You can turn HTML back on with
ODS HTML;
but there are probably other options you need...like a filename
ODS html file="My File.htm";
ODS HTML