I am trying to match coordinates with 9062 IATA codes that I have compiled in a CSV file. I have tried to use iMacros to input the IATA codes into this website: https://openflights.org/html/apsearch and to extract the coordinates that result.
When executing the macro I do not receive an error, but none of the values are extracted to my designated CSV (the CSV file is blank).
Here is the code:
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !DATASOURCE C:\REDACTED\Desktop\iatasolo.csv
SET !DATASOURCE_COLUMNS 1
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=https://openflights.org/html/apsearch
SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:searchform ATTR=NAME:iatafilter CONTENT=NO
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchform ATTR=NAME:iata CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:searchform ATTR=*
TAG POS=6 TYPE=INPUT:BUTTON ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchform ATTR=NAME:y EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchform ATTR=NAME:x EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=C:\REDACTED\Desktop\macro\test2 FILE=coordinates.csv
Any help would be appreciated.
IATA CODE DATA: https://pastebin.com/4Ez4ids3
I ran your code with the sample data and the website and checked the issues.
List of Issues:
The input file was not getting detected. This was fixed by putting the path in quotes and using the "/" instead of "\" which is used in windows paths.
I have a wait of 2 seconds after the load button is clicked to give time for latitude and longitude to load.
Similarly output should have a different kind of format, this is what worked for me.
Please find below the working code:
VERSION BUILD=9030808 RECORDER=FX
SET !ERRORIGNORE YES
SET !DATASOURCE "C:/Users/Tester/Desktop/file_name.csv"
SET !DATASOURCE_COLUMNS 1
SET !TIMEOUT_STEP 30
SET !EXTRACTDIALOG NO
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=https://openflights.org/html/apsearch
SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:searchform ATTR=NAME:iatafilter CONTENT=NO
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchform ATTR=NAME:iata CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:searchform ATTR=*
TAG POS=6 TYPE=INPUT:BUTTON ATTR=*
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchform ATTR=NAME:iata EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchform ATTR=NAME:y EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:searchform ATTR=NAME:x EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER="C:\\Users\\Tester\\Desktop" FILE=coordinates.csv
Related
'part 1 - copy session
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:product-form ATTR=ID:Name EXTRACT=TXT
SET !VAR1 EVAL("\"{{!EXTRACT}}\".replace(/a'/g, \"à\") .replace(/e'/g, \"è\") .replace(/i'/g, \"ì\") .replace(/o'/g, \"ò\") .replace(/u'/g, \"ù\") .replace(/A'/g, \"À\") .replace(/E'/g, \"È\") .replace(/I'/g, \"Ì\") .replace(/O'/g, \"Ò\") .replace(/U'/g, \"Ù\")")
SET !EXTRACT NULL
TAG POS=1 TYPE=A ATTR=TXT:EN
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:product-form ATTR=ID:Locales_1__Name EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}
SET !EXTRACT NULL
WAIT SECONDS=2.0
'part 2 - paste session
TAG POS=1 TYPE=A ATTR=TXT:IT
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:product-form ATTR=ID:Locales_0__Name CONTENT={{!VAR1}}
etc
etc
etc
This is the first part of code I used until now.
Now I need to copy my source text from another tab of chrome in order to make this one the {{!VAR1}} which will be pasted all over the textboxes in another tab.
TAB T=1
FRAME F=2
TAG POS=1 TYPE=DIV ATTR=CLASS:MagicZoomHeader EXTRACT=TXT
SET !VAR1 EVAL("\"{{!EXTRACT}}\".replace(/a'/g, \"à\") .replace(/e'/g, \"è\") .replace(/i'/g, \"ì\") .replace(/o'/g, \"ò\") .replace(/u'/g, \"ù\") .replace(/A'/g, \"À\") .replace(/E'/g, \"È\") .replace(/I'/g, \"Ì\") .replace(/O'/g, \"Ò\") .replace(/U'/g, \"Ù\")")
SET !EXTRACT NULL
TAB T=2
This is the code which extract the text I need from TAB 1.
In order to do this, I write the code using TAB T=1 (to copy and create the first VAR) and TAB T=2 in order to paste the text.
When the macro goes to TAB 2 (starting part 2), suddenly stopped working doing a sort of infinite loading before process this
TAG POS=1 TYPE=A ATTR=TXT:IT
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:product-form ATTR=ID:Locales_0__Name CONTENT={{!VAR1}}
Why this happens? How can I resolve that?
I want to select values from two excel sheet(CSV) using imacro
Example:
Sheet 1 is having 2 values
Sheet 2 is having 3 values
I want to select the values from both the sheets so that i can fill form using imacro
VERSION BUILD=844 RECORDER=CR
SET !DATASOURCE Chrometest.csv
SET !DATASOURCE_COLUMNS 8
URL GOTO=https://docs.google.com/forms/d/e/1FAIpQLSfCr5ZoLQFLw8ZUnRSOdwP-wuyPXpZbd-uWe7-DkHkBt47QVw/viewform
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_757433527 CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_414022470 CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_1960753282 CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_549681952 CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_436972228 CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_1842450612 CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_926019437 CONTENT={{!COL7}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_1850440789 CONTENT={{!COL8}}
please help
CSV is a very simple format and doesn't have the concept of a Sheets. The only ways is, you pass to multiple csv files.
Following code will work:
SET !DATASOURCE Chrometestfile1.csv
SET !DATASOURCE_COLUMNS 2
URL GOTO=https://docs.google.com/forms/d/e/1FAIpQLSfCr5ZoLQFLw8ZUnRSOdwP-wuyPXpZbd-uWe7-DkHkBt47QVw/viewform
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_757433527 CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_414022470 CONTENT={{!COL2}}
SET !DATASOURCE Chrometestfile2.csv
SET !DATASOURCE_COLUMNS 3
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_1960753282 CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_549681952 CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_436972228 CONTENT={{!COL3}}
I'm using Windows 7 and Firefox 44.0.2. I'm trying to schedule some posts on Tumblr using iMacros. When iMacros creates a post it adds an image and I want to write some code in html. Let's say:
<div>abcd</div>
but neither in caption nor in tags (If I want to write"test") anything appear.
This is my code
VERSION BUILD=8961227 RECORDER=FX
TAB T=1
TAG POS=1 TYPE=I ATTR=CLASS:icon_post_photo&&TXT:
TAG POS=1 TYPE=INPUT:FILE ATTR=NAME:photo CONTENT=E:\myDirectory\img.jpg
TAG POS=1 TYPE=BUTTON ATTR=DATA-JS-CLICKABLEPOSTSETTINGSCOG:&&CLASS:post-settings&&TXT:
TAG POS=1 TYPE=SELECT ATTR=ID:editorType CONTENT=%html
TAG POS=1 TYPE=DIV ATTR=CLASS:ace_content&&TXT:
TAG POS=1 TYPE=TEXTAREA ATTR=WRAP:off&&CLASS:ace_text-input&&SPELLCHECK:false&&ARIA-LABEL:HTML<SP>content&&TXT: CONTENT=<div>abcd</div>
TAG POS=3 TYPE=DIV ATTR=TXT:#tags
TAG POS=3 TYPE=DIV ATTR=TXT:test
TAG POS=5 TYPE=DIV ATTR=TXT:test
what coould be the problem?
* UPDATE *
following the answer provided here by Shugar, I inserted that code and now I can make iMacros write text caption and alt tags but if I make iMacros change into html it won't write code in it. Here:
TAB T=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Photo
TAG POS=1 TYPE=INPUT:FILE ATTR=NAME:photo CONTENT=E:\myDirectory\img.jpg
' here i ask iMacros to change open html instead of plain text caption
TAG POS=1 TYPE=BUTTON ATTR=DATA-JS-CLICKABLEPOSTSETTINGSCOG:&&CLASS:post-settings&&TXT:
TAG POS=1 TYPE=SELECT ATTR=ID:editorType CONTENT=%html
' wait to load the image
WAIT SECONDS=10
' caption
EVENT TYPE=CLICK SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV>P" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV" CHARS="<div>abdcdsa</div>"
WAIT SECONDS=0.5
' tag #1
EVENT TYPE=CLICK SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV" CHARS="my tag1"
EVENTS TYPE=KEYPRESS SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV" CHARS=""
WAIT SECONDS=0.5
' tag #2
EVENT TYPE=CLICK SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV" CHARS="my tag2"
EVENTS TYPE=KEYPRESS SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV>DIV" CHARS=""
WAIT SECONDS=0.5
' tags etc.
' ...
* UPDATE 2 *
after trying the code given by Shugar this is what I have but it stucks on line 11 and keep loading forever:
eTAB T=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Photo
TAG POS=1 TYPE=INPUT:FILE ATTR=NAME:photo CONTENT=C:mydirectory\sample.jpg
' here i ask iMacros to change open html instead of plain text caption
TAG POS=1 TYPE=BUTTON ATTR=DATA-JS-CLICKABLEPOSTSETTINGSCOG:&&CLASS:post-settings&&TXT:
TAG POS=1 TYPE=SELECT ATTR=ID:editorType CONTENT=%html
' wait to load the image
WAIT SECONDS=10
' caption '
TAG POS=1 TYPE=BUTTON ATTR=DATA-JS-CLICKABLEPOSTSETTINGSCOG:&&CLASS:post-settings&&TXT:
TAG POS=1 TYPE=SELECT ATTR=ID:editorType CONTENT=%html
EVENT TYPE=CLICK SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(3)>DIV" BUTTON=0
SET !ERRORIGNORE YES
URL GOTO=javascript:alert();
SET !ERRORIGNORE NO
SET captionHtml "<div>caption text</div>"
EVENTS TYPE=KEYPRESS SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>TEXTAREA" CHARS={{captionHtml}}e
Your macro must look like this:
TAB T=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Photo
TAG POS=1 TYPE=INPUT:FILE ATTR=NAME:photo CONTENT=C:\mydirectory\sample.jpg
' wait to load the image '
WAIT SECONDS=10
' here i ask iMacros to change open html instead of plain text caption '
TAG POS=1 TYPE=BUTTON ATTR=DATA-JS-CLICKABLEPOSTSETTINGSCOG:&&CLASS:post-settings&&TXT:
TAG POS=1 TYPE=SELECT ATTR=ID:editorType CONTENT=%html
' caption '
EVENT TYPE=CLICK SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV:nth-of-type(3)>DIV" BUTTON=0
SET !ERRORIGNORE YES
URL GOTO=javascript:alert();
SET !ERRORIGNORE NO
SET captionHtml "<div>caption text</div>"
EVENTS TYPE=KEYPRESS SELECTOR="#new_post_buttons>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(2)>DIV>DIV>TEXTAREA" CHARS={{captionHtml}}
At least it works perfectly for me :)
I am running a macro script which will upload urls from .csv sheet.
My code is as follows
VERSION BUILD=8881205 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
'SET !ERRORIGNORE YES
URL GOTO=about:newtab
'URL GOTO=https://www.google.com/analytics/web/?hl=en#report/visitors-
SET !DATASOURCE C:\Users\users\Downloads\ga_urls.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO={{!COL1}}
WAIT SECONDS=1
TAG POS=6 TYPE=DIV ATTR=CLASS:_GAWc
WAIT SECONDS=1
'TAG POS=14 TYPE=DIV ATTR=CLASS:_GAPB
TAG POS=1 TYPE=DIV ATTR=CLASS:ID-new-acquisition-campaigns-subsection-item<SP>_GAz-_new_acquisition_campaigns_subsection<SP>ACTION-open<SP>TARGET-new-acquisition-campaigns-subsection<SP>_GAJc*
WAIT SECONDS=1
TAG POS=1 TYPE=A ATTR=TITLE:Organic<SP>Keywords&&CLASS:_GAg
WAIT SECONDS=1
TAG POS=1 TYPE=TD ATTR=CLASS:_GAYo
WAIT SECONDS=1
TAG POS=1 TYPE=SELECT ATTR=CLASS:ID-datecontrol-shortcuts<SP>ACTION-shortcuts<SP>TARGET-select<SP>_GAEB CONTENT=%last7days
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=TYPE:checkbox&&CLASS:ID-date_compare_mode<SP>_GAqzb CONTENT=YES
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:BUTTON ATTR=TYPE:button&&VALUE:Apply&&CLASS:ID-apply<SP>ACTION-apply<SP>TARGET-<SP>_GAD7b
WAIT SECONDS=1
SET !VAR1 NULL
SET !VAR2 NULL
TAG POS=1 TYPE=DIV ATTR=CLASS:_GAm8b&&TXT:* EXTRACT=HTM
WAIT SECONDS=1
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.search(/_GAXDb _GAFUb _GAIW/i);")
'SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.trim()")
SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=CLASS:_GAm8b&&TXT:* EXTRACT=TXT
WAIT SECONDS=1
SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; s.trim();")
SET !EXTRACT NULL
TAG POS=1 TYPE=LI ATTR=CLASS:ID-accounts-summary-1<SP>_GAKFb&&TXT:* EXTRACT=TXT
SET !VAR3 EVAL("var s=\"{{!EXTRACT}}\"; s.trim()")
SET !EXTRACT NULL
ADD !EXTRACT {{!VAR1}}
ADD !EXTRACT {{!VAR2}}
ADD !EXTRACT {{!VAR3}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=values_ga_urls.csv
SET !VAR1 NULL
SET !VAR2 NULL
SET !VAR3 NULL
the code runs perfectly for 1st url and on 2nd url it gives error.
And if i uncomment SET !ERRORIGNORE YES i realized it took all alternative urls like 1st then 3rd then 5th.
And my .csv file is as follows
Also if i manually put url in browser the page is opening so urls are valid.
I found it weird. Can anyone find what is the bug?
Thanks
Try this:
1.Go back to home page of Google Analytics before script ends
2.And then let new url(2nd row data from excel sheet be called in URL GOTO={{!COL1}})
I have this code that checks for text on a page and then saves the text to a csv:
TAG POS=1 TYPE=DIV ATTR=TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=C:\test FILE=test.csv
Is it possible to add my own text to the extracted TXT, I tried this:
TAG POS=1 TYPE=DIV ATTR=TXT:*+{{!CLIPBOARD}} EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=C:\test FILE=test.csv
So, this time I want it to save to the CSV as "textInDiv","clipboardValue"
Thanks.
TAG POS=1 TYPE=DIV ATTR=TXT:* EXTRACT=TXT
ADD !EXTRACT {{!CLIPBOARD}}
SAVEAS TYPE=EXTRACT FOLDER=C:\test FILE=test.csv
http://wiki.imacros.net/ADD
to save to the CSV as "textInDiv","clipboardValue", try this:
TAG POS=1 TYPE=DIV ATTR=TXT:* EXTRACT=TXT
SET !EXTRACT {{!EXTRACT}}[EXTRACT]{{!CLIPBOARD}}
SAVEAS TYPE=EXTRACT FOLDER=C:\test FILE=test.csv