javascriptimacros

Is it still possible to run imacros with javascript in newer versions?


I've been using imacros for 3 weeks and I'm running into an issue.

I've finished my code, it works fine, but for further automation, I need to run 2 macros back to back (one was recorded in normal mode, the other one in event mode). I included the code below just in case)

I've looked around and found out that calling the 2 macros in a javascript file could resolve my issue, but I don't know if it's still possible, and if it's not, what alternatives could I use.

I'm using imacro's google chrome extension version 10.0.5. and in case javascript isn't supported by chrome, I also downloaded firefox 76.0.1 with imacros 10.0.2 (window 10)

So my final question is - is it still possible to run macros in javascript files with the newer versions, and if it is, how can I do it.

Thank you

VERSION BUILD=1005 RECORDER=CR
URL GOTO=https://www.kwyk.fr/exercices/mathematiques/6e/calcul-mental/multiplication/
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=SPAN ATTR=CLASS:"base displaystyle textstyle uncramped" EXTRACT=TXT
TAB T=2
URL GOTO=https://www.google.com/search?q={{!EXTRACT}}&oq=50&aqs=chrome.0.69i59j69i57j0l2j46j69i61j69i60l2.3623j0j7&sourceid=chrome&ie=UTF-8
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=JSNAME:VssY5c&&ID:cwos EXTRACT=TXT
TAB T=1
SET !VAR3 EVAL("'\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0';")
SET !VAR2 EVAL("'{{!EXTRACT}}'.concat('{{!VAR3}}');")
SET !VAR1 EVAL("'{{!VAR2}}'.substring(0,1);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(1,2);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(2,3);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(3,4);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(4,5);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(5,6);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(6,7);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(7,8);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(8,9);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(9,10);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(10,11);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(11,12);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(12,13);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(13;14);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(14;15);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
SET !VAR1 EVAL("'{{!VAR2}}'.substring(15;16);")
TAG POS=1 TYPE=TEXTAREA FORM=ACTION:/exercise/submit/ ATTR=AUTOCOMPLETE:off&&AUTCORRECT:off&&AUTOCAPITALIZE:off CONTENT={{!var1}}
EVENT TYPE=CLICK SELECTOR="#id_answer_0_math0" BUTTON=0
EVENT TYPE=KEYPRESS SELECTOR="#id_answer_0_math0>SPAN>TEXTAREA" KEY=8

Solution

  • Nope, '.js' Scripts are not supported in the 2 v10.0.x Versions for FF/CR you mention.

    '.js' Scripts are only supported in FF until iMacros for FF v9.0.3 (buggy and limited), recommended = v8.9.7 for FF (downloadable from the iMacros Wiki Page for 'iMacros for FF Legacy') that works until FF56, recommended = FF v55.0.3.

    The same iMacros v8.9.7 for FF Version also works in Browsers forked on FF that didn't adopt the 'WebExtensions' Architecture like Pale Moon (v28) or Basilisk (v2019/2020)... (+ WaterFox & CyberFox).

    (Your Script looks a bit "cumbersome" btw, ah-ah...!)

    EDIT:
    And hum..., I'm not sure what you mean by "back to back", but if you simply want to run both Scripts in a row, iMacros Scripts are editable and "concatenable" and you can mix different Modes in a same Script, => you can simply add/paste the 2 Lines from your 'EVENT' Mode 2nd Script at the end of your 'TAG' Mode 1st Script...