Reputation: 4642
I am new to iMacro. I try to record a script where I had clicked a pop up when it will appear on the screen. The problem is, popup will appear when any new event posted. So at the time of making the script it was available, but when I am looping the script it's getting the error because it cloud not found the script.
My code looks like this -
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUTTON=0
TAB T=2
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(7)>DIV:nth-of-type(2)>A" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(5)>DIV>FOOTER>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(11)>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>A" BUTTON=0
I am getting error at the first line.
(Error code: -921)
Upvotes: 1
Views: 377
Reputation: 58139
Is there any way if any error happen it will start executing from the start again.
Answer:
The fix for this will be to add the line to the top of your imacros script
SET !ERRORIGNORE YES
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(7)>DIV:nth-of-type(2)>A" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(5)>DIV>FOOTER>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(11)>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>A" BUTTON=0
And also any way to increase the loop number?
Answer: you need to use javascript and create an infinite loop if necessary, you can end this loop by pressing the stop button, so instead of an imacros file (macro.iim) we will create the below file (macro.js). The timeout is added because the different selectors will be checked with a gap of 1 second this can also be set to 0 if needed.
The contents of the macro.js file will be as follows:
var macro;
macro= 'CODE:';
macro+= 'SET !TIMEOUT_STEP 1' + '\n';
macro+= 'SET !ERRORIGNORE YES' + '\n';
macro+= 'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUTTON=0' + '\n';
macro+= 'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(7)>DIV:nth-of-type(2)>A" BUTTON=0' + '\n';
macro+= 'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(5)>DIV>FOOTER>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0' + '\n';
macro+= 'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(11)>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>A" BUTTON=0' + '\n';
while(true){
iimPlay(macro);
};
Upvotes: 1