Cheatsheet

  • iim
  • Javascript

Checkout imacros wiki for the full command reference.
iMacros Command ReferenceMeaning:
URL GOTO=http://imacropro.comgo to website
SET !TIMEOUT_PAGE 15set time limit on waiting for a page to load (number signifies seconds)
SET !TIMEOUT_STEP 0remove time on waiting for a element to be found (by default it waits up to 6 seconds)
SET !ERRORIGNORE YESignore errors
SET !DATASOURCE C:\imacros\imacropro.csvset location of csv file in computer
SET !DATASOURCE_LINE 1set the line of data to use from csv file
FILEDELETE NAME=C:\imacros\imacropro.csvdelete any file from computer
SET !USERAGENT "Mozilla/1.22 (compatible; MSIE 10.0; Windows 3.1)"set browser useragent
PROXY ADDRESS=192.1.8.1:8080 set proxy
URL GOTO=javascript:window.scrollBy(0,-20000)scroll up
URL GOTO=javascript:window.scrollBy(0,20000)scroll down
TAB CLOSEALLOTHERSclose all tabs in browser except the current active tab
TAB OPENopen new tab in browser
TAB CLOSEclose current tab in browser / close firefox
WAIT SECONDS=2wait seconds, (replace with any number even half sec are fine e.g. 2.5)
REFRESHrefresh current window (same as pressing F5)
CLEARclear browser cache and cookies
BACKvisit previous website/page
CONTENT=EVENT:MOUSEOVERhover over element instead of clicking e.g. TAG POS=1 TYPE=A ATTR=TXT:TUTS CONTENT=EVENT:MOUSEOVER
SEARCH SOURCE=REGEXP:"([\\s\\S]*)" EXTRACT="$1"extract page source code
SET trimmedValue EVAL("\"{{!EXTRACT}}\".replace(/^\\s*|\\s*$/g, \"\");")Trim leading and trailing spaces from extract with eval javascript
SET !EXTRACT NULLclear extract
SET title {{!EXTRACT}}set extract to a custom variable
SAVEAS TYPE=EXTRACT FOLDER=* FILE=extracted-data.csvsave extracted data

Checkout w3schools for the full JavaScript string reference. Click here for Regex Cheatsheet
JavaScript iMacros Command Reference Meaning:
iimPlay(macro);play a macro
iimDisplay("Display some text");display text on bottom left corner of screen
iimDisplay("Current loop: "+ i);display loop number
var lastExtract = iimGetLastExtract();turn last extract to a variable.
var error = iimGetLastError();turn the last error description to a variable
window.scrollBy(0,-20000)scroll up
window.scrollBy(0,20000)scroll down
window.close();close tab/firefox
Math.floor((Math.random() * 7) + 5);Return a random number between 5 and 12
iimPlay ("CODE:WAIT SECONDS=0.5");Play imacros code in .js script