Search code examples
imacros

iMacros : retrieve a iMacros variable, and use within Javascript


on iMacros, it is possible to retrieve a javascript variable to iMacros.

Like this: SET !VAR1 EVAL("var ... ;")

But I have been looking for several days how do the opposite? I found nothing in the documentation or elsewhere on the www. retrieve a IMacros variable, and use within Javascript, Is this possible?

thank you


Solution

  • You can use {{VARNAME}} inside your javascript:

    SET x "hello"
    SET !VAR1 EVAL("var x='{{x}}'; x+' world'")
    PROMPT {{!VAR1}}
    

    It'll alert hello world