Search code examples
formsimacros

iMacros Script error


VERSION BUILD=844 RECORDER=CR
URL GOTO=https://EXFESDGT.org/edit
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:editForm ATTR=ID:customURL CONTENT=ASHFUO3ENFO2N32O
TAG POS=1 TYPE=BUTTON FORM=ID:editForm ATTR=TXT:Save<SP>Changes
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:editForm ATTR=ID:customURL CONTENT=ASF23FS34
TAG POS=1 TYPE=BUTTON FORM=ID:editForm ATTR=TXT:Save<SP>Changes
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:editForm ATTR=ID:customURL CONTENT=pas3FS34
TAG POS=1 TYPE=BUTTON FORM=ID:editForm ATTR=TXT:Save<SP>Changes
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:editForm ATTR=ID:customURL CONTENT=ksk3FS34
TAG POS=1 TYPE=BUTTON FORM=ID:editForm ATTR=TXT:Save<SP>Changes
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:editForm ATTR=ID:customURL CONTENT=3f3ds23FS34
TAG POS=1 TYPE=BUTTON FORM=ID:editForm ATTR=TXT:Save<SP>Changes 

Whenever I try to run this macro in the specic website it just applies until the first line after loading the edit page. I want it to loop changing the custom url saving & reloading the page


Solution

  • Updated Answer:

    Based on the new requirements I have modified the code, I dont know where to add the wait 1 you had mentioned.

    I have chosen an awesome function in the post of Nimphious the link to this function is here

    So you need to set three variables to setup the function, The variables need to written in the eval function, refer to the imacros code below, the details explanation of the variables is shown below:

    1. characters:

    if characters is set to the below character only those characters under the parameter are set.

    'a' -> 'abcdefghijklmnopqrstuvwxyz';
    'A' -> 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    '#' -> '0123456789';
    

    2. Max:

    It represents the maximum length of the string that can be present.

    3. Min:

    It represents the minimum length of the string that can be present.

    SET !LOOP 1
    'URL GOTO=https://EXFESDGT.org/edit
    SET !VAR1 EVAL("var characters = '#'; var max = 20; var min = 32;function randomString(length, chars) {    var mask = '';    if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz';    if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';    if (chars.indexOf('#') > -1) mask += '0123456789';    var result = '';    for (var i = length; i > 0; --i) result += mask[Math.floor(Math.random() * mask.length)];    return result;};var randomString=randomString(Math.random() * (max - min) + min, characters); randomString;")
    TAG POS=1 TYPE=INPUT:TEXT FORM=ID:editForm ATTR=ID:customURL CONTENT={{!var1}}
    TAG POS=1 TYPE=BUTTON FORM=ID:editForm ATTR=TXT:Save<SP>Changes
    

    Old Answer: You can use this simple macro to insert a random string into the field and click 'Save Changes' every time. If you need to refresh the page, add the commented line also. Dont forget to loop this macro any number of times as per need.

    SET !LOOP 1
    'URL GOTO=https://EXFESDGT.org/edit
    SET !VAR1 EVAL("var randomString=Math.random().toString(36).substr(7); randomString;")
    PROMPT {{!var1}}
    TAG POS=1 TYPE=INPUT:TEXT FORM=ID:editForm ATTR=ID:customURL CONTENT={{!var1}}
    TAG POS=1 TYPE=BUTTON FORM=ID:editForm ATTR=TXT:Save<SP>Changes