Using Windows Task Scheduler you can completely automate iMacros, you can setup your script to run whenever you want without having to manually start it. You can choose the time and day for the script to play plus you can have it play repeatedly for example daily, once a week, even have it play multiple times a day.

Follow these steps:

1. Create a .bat file on your desktop and paste the code in below. (Download .bat file)

**This file is a small program that will open firefox and play an imacros script.@echo off
start firefox.exe -P default -no-remote imacros://run/?m=ADDMEFAST/AMF-Master.js

Notice the highlighted parts in the code:
First highlighted part put the name of the firefox profile to open, (Leave as default if you only have 1 profile)
Second part highlighted put the name of the iMacros script you want to play.

2. Click on Create Basic Task in Windows Task Scheduler, follow the steps and use the new .bat file you just created.

create imacros basic task

task scheduler bat file

3. Make sure the exit firefox option in script is marked as yes if you are using one of my scripts.

imacros exit firefox

NOTE: If you aren’t using one of my scripts then add code to the end of your script to close firefox if you plan on having the task scheduler run your script more than once. Check cheatsheet below for the code.

Checkout imacros wiki for the full command reference.
URL GOTO=https://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 !EXTRACT_TEST_POPUP NOdisable the extract testing popup
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
SET !VAR1 EVAL(“var randomNumber=Math.floor(Math.random()*20 + 1); randomNumber;”)returns random number between 1-20
FILEDELETE NAME=C:\imacros\imacropro.csvdelete any file from your computer
SET !USERAGENT “Mozilla/1.22 (compatible; MSIE 10.0; Windows 3.1)”set browser useragent
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
PAUSEpause script
SET current {{!NOW:mm-dd-yyyy-hh:mm}}Get current date and time
SEARCH SOURCE=REGEXP:”([\\s\\S]*)” EXTRACT=”$1″extract page source code
SET !VAR2 EVAL(“‘{{!EXTRACT}}’.trim()”)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
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

SUCCESS! Your script will now automatically play at the time and day you specified as long as your computer is on.


– Minimize Firefox

If you want the firefox browser to be minimized when scripts play automatically you can download the addon Minimize On Start and Close. This addon will automatically minimize the firefox browser on startup so that automated scripts don’t disturb you when you are using your computer.

After installing addon, click Options and set the settings as shown below.
minimize firefox