Imacros Error: SyntaxError: missing ; before statement (Error code: 991)

hillz

Registered Member
Joined
Aug 14, 2011
Messages
55
Reaction score
3
Hi, I'm new to javascript and I'm trying to write macro codes in javascript but I'm getting this error SyntaxError: missing ; before statement (Error code: 991) here's the script:

Code:
var macro;macro =  "CODE:";
macro +=  "VERSION BUILD=8001865" + "\n"; 
macro +=  "SET !ERRORIGNORE YES" + "\n"; 
macro +=  "SET !ERRORCONTINUE YES" + "\n"; 
macro +=  "SET !TIMEOUT 180" + "\n"; 
macro +=  "SET !TIMEOUT_STEP 0" + "\n"; 
macro +=  "SET !EXTRACT_TEST_POPUP NO" + "\n"; 
macro +=  "'SET !DATASOURCE Original_Articles.csv" + "\n"; 
macro +=  "'SET !DATASOURCE_COLUMNS 2" + "\n"; 
macro +=  "'SET !DATASOURCE_LINE {{!LOOP}}" + "\n"; 
macro +=  "TAB T=1" + "\n"; 
macro +=  "TAG POS=1 TYPE=A ATTR=HREF:http://awebsite.com/?*&id=* EXTRACT=HREF" + "\n"; 
macro +=  "TAB OPEN" + "\n"; 
macro +=  "TAB T=2" + "\n"; 
macro +=  "URL GOTO={{!EXTRACT}}" + "\n"; 
macro +=  "SET !EXTRACT NULL" + "\n"; 
macro +=  "TAG POS=1 TYPE=H1 ATTR=TXT:* EXTRACT=TXT" + "\n"; 
[B]macro +=  "SET !VAR1 EVAL("var judul='{{!EXTRACT}}'; judul=judul + <br />; judul; ")" + "\n"; [/B]
macro +=  "SET !EXTRACT {{!VAR1}}" + "\n"; 
macro +=  "TAG POS=1 TYPE=DIV ATTR=ID:article-body EXTRACT=TXT" + "\n"; 
[B]macro +=  "SET !VAR2 EVAL("var sumber='{{!EXTRACT}}'; sumber=sumber.replace(/Article (.*)/,''); sumber=sumber.replace(/http(.*)/,''); sumber=sumber.replace(/\t/g,'');  sumber; ")" + "\n"; [/B]
macro +=  "SET !EXTRACT {{!VAR2}}" + "\n"; 
[B]macro +=  "SET !VAR3 EVAL[/B][B]("var sumber='{{!VAR2}}'; sumber=sumber.replace(/http(.*)/,''); sumber; ")" + "\n"; [/B]
macro +=  "SET !EXTRACT {{!VAR3}}" + "\n"; 
macro +=  "SAVEAS TYPE=EXTRACT FOLDER=C:\Users\galih\Dropbox\My<SP>Computer<SP>Backup\iMacros\Datasources FILE=Original_Articles.csv" + "\n"; 
macro +=  "SET !EXTRACT NULL" + "\n"; 
macro +=  "TAB CLOSE" + "\n"; 


for (i = 0; i < 7; i++)
{
  iimPlay(macro);
}

I saved the script in the .js extension. My guess is that perhaps the code macro += "SET !VARx EVALxxx is what causing the error. What the heck is wrong with that script?
 
Last edited:
Silly error buddy you have to escape the double quotes inside other wise it will fail

so for example:
Code:
"SET !VAR1 EVAL("var judul='{{!EXTRACT}}'; judul=judul + <br />; judul; ")" + "\n";

Becomes
Code:
"SET !VAR1 EVAL(\"var judul='{{!EXTRACT}}'; judul=judul + <br />; judul; \")" + "\n";

Keep in mind that any double quote inside your first set of "..." should be escaped or it will fail.
 
Back
Top