firefoxrandomimacros

IMacros random choose


Each time I run the script, I am trying to select at random one from the following:

TAG POS=1 TYPE=IMG ATTR=SRC:photolink1
TAG POS=1 TYPE=IMG ATTR=SRC:photolink2
TAG POS=1 TYPE=IMG ATTR=SRC:photolink3

This is probably quite an easy questions - this is my first project with this program.


Solution

  • SET !VAR1 EVAL("var options = ['photolink1','photolink2','photolink3']; var string = ''; for(var i = 0; i < 1; i++){string += options[parseInt(Math.random() * 3)]}; string")
    
    TAG POS=1 TYPE=IMG ATTR=SRC:{{!VAR1}}
    

    this should work to randomly choose one of the options.