Imacros Javascript Issues

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
mccarthy995
Posts: 8
Joined: Fri Aug 03, 2018 4:27 pm

Imacros Javascript Issues

Post by mccarthy995 » Thu Nov 29, 2018 2:49 pm

What version of iMacros are you using?
VERSION BUILD=9030808

What operating system are you using?
ENG UK WIN 10 64bit

Which browser are you using?
FF 52.0.1 (32-bit)

---------------------------------------------------------------------

Hello!
I'm back again with another issue, Im starting to get a lot better with Imacros, it's just javascript I'm working on now.
I cannot for the life of me find out why this code is failing.

The error I am getting is: MacroSyntaxError: wrong format of SET command, line 24 (Error code: -910)

The code below just assigns extracted information and assigns them to {{!VAR*}} to be used later in the script, most of it's copied and pasted..

I have ran the Full name part and it works fine.
I then added the Service ID code and that was also extracting the correct information.
When you get further down to line 24 (I assume that Macros doesn't count var CODE; as a line ??) SET !VAR4 {{!EXTRACT}} Doesn't want to run for some reason. line 24 has been copied and pasted from the working lines of code and all I have done is changed the number of the !VAR.

Any Ideas? :?

Code: Select all

var CODE;
CODE ="CODE:";

CODE +="SET !REPLAYSPEED FAST "+"\n";
CODE +="SET !ERRORIGNORE YES "+"\n";
CODE +="SET !WAITPAGECOMPLETE YES "+"\n";
CODE +="SET !TIMEOUT_STEP 2 "+"\n";
CODE +="SET !EXTRACT_TEST_POPUP NO "+"\n";

//Full Name
  CODE +="TAG POS=1 TYPE=DT ATTR=TXT:Name: "+"\n";
   CODE +="TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR1 {{!EXTRACT}} "+"\n";
     CODE +="SET !EXTRACT NULL "+"\n";

//Service ID
  CODE +="TAG POS=1 TYPE=DT ATTR=TXT:Service<sp>ID: "+"\n";
   CODE +="TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR2 {{!EXTRACT}} "+"\n";
     CODE +="SET !EXTRACT NULL "+"\n";

//Postal Code
  CODE +="TAG POS=1 TYPE=DT ATTR=TXT:Address: "+"\n";
   CODE +="TAG POS=R5 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR4 {{!EXTRACT}} "+"\n";
     CODE +="SET !EXTRACT NULL "+"\n";

//CLI
  CODE +="TAG POS=1 TYPE=DT ATTR=TXT:CLI<sp>Number* "+"\n";
   CODE +="TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR5 {{!EXTRACT}} "+"\n";
     CODE +="SET !EXTRACT NULL "+"\n";

//Retailer
  CODE +="TAG POS=1 TYPE=SPAN ATTR=TXT:Account:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR6 {{!EXTRACT}} "+"\n";
      CODE +="SET !VAR6 EVAL('var s='{{!VAR6}}'; var z=s.substr(8,4); z;') "+"\n";
       CODE +="SET !EXTRACT NULL  "+"\n";

iimPlay(CODE);
chivracq
Posts: 8330
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros Javascript Issues

Post by chivracq » Thu Nov 29, 2018 3:31 pm

mccarthy995 wrote:What version of iMacros are you using?
VERSION BUILD=9030808

What operating system are you using?
ENG UK WIN 10 64bit

Which browser are you using?
FF 52.0.1 (32-bit)

---------------------------------------------------------------------

Hello!
I'm back again with another issue, Im starting to get a lot better with Imacros, it's just javascript I'm working on now.
I cannot for the life of me find out why this code is failing.

The error I am getting is: MacroSyntaxError: wrong format of SET command, line 24 (Error code: -910)

The code below just assigns extracted information and assigns them to {{!VAR*}} to be used later in the script, most of it's copied and pasted..

I have ran the Full name part and it works fine.
I then added the Service ID code and that was also extracting the correct information.
When you get further down to line 24 (I assume that Macros doesn't count var CODE; as a line ??) SET !VAR4 {{!EXTRACT}} Doesn't want to run for some reason. line 24 has been copied and pasted from the working lines of code and all I have done is changed the number of the !VAR.

Any Ideas? :?

Code: Select all

var CODE;
CODE ="CODE:";

CODE +="SET !REPLAYSPEED FAST "+"\n";
CODE +="SET !ERRORIGNORE YES "+"\n";
CODE +="SET !WAITPAGECOMPLETE YES "+"\n";
CODE +="SET !TIMEOUT_STEP 2 "+"\n";
CODE +="SET !EXTRACT_TEST_POPUP NO "+"\n";

//Full Name
  CODE +="TAG POS=1 TYPE=DT ATTR=TXT:Name: "+"\n";
   CODE +="TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR1 {{!EXTRACT}} "+"\n";
     CODE +="SET !EXTRACT NULL "+"\n";

//Service ID
  CODE +="TAG POS=1 TYPE=DT ATTR=TXT:Service<sp>ID: "+"\n";
   CODE +="TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR2 {{!EXTRACT}} "+"\n";
     CODE +="SET !EXTRACT NULL "+"\n";

//Postal Code
  CODE +="TAG POS=1 TYPE=DT ATTR=TXT:Address: "+"\n";
   CODE +="TAG POS=R5 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR4 {{!EXTRACT}} "+"\n";
     CODE +="SET !EXTRACT NULL "+"\n";

//CLI
  CODE +="TAG POS=1 TYPE=DT ATTR=TXT:CLI<sp>Number* "+"\n";
   CODE +="TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR5 {{!EXTRACT}} "+"\n";
     CODE +="SET !EXTRACT NULL "+"\n";

//Retailer
  CODE +="TAG POS=1 TYPE=SPAN ATTR=TXT:Account:* EXTRACT=TXT "+"\n";
    CODE +="SET !VAR6 {{!EXTRACT}} "+"\n";
      CODE +="SET !VAR6 EVAL('var s='{{!VAR6}}'; var z=s.substr(8,4); z;') "+"\n";
       CODE +="SET !EXTRACT NULL  "+"\n";

iimPlay(CODE);
Your Line_24 will rather be the 'EVAL()', I reckon...:

Code: Select all

      CODE +="SET !VAR6 EVAL('var s='{{!VAR6}}'; var z=s.substr(8,4); z;') "+"\n";
Try changing it into this one:

Code: Select all

      CODE +='SET !VAR6 EVAL("var s='{{!VAR6}}'; var z=s.substr(8,4); z;") '+"\n";
'!REPLAYSPEED=FAST' is already the Default btw, has no real use in your Script I would think, unless you've changed the Default Value in the iMacros Options or if you "sometimes" need to slow down your Script a bit...
And '!WAITPAGECOMPLETE' is not supported on FF...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply