Restart iMacros from the beginning - imacros

i want to restart my iMacros from the beginning, without using java.
So for example:
WAIT SECONDS=1
URL GOTO=https://en.wikipedia.org/wiki/Main_Page
WAIT SECONDS=1
RESTART <----NOT EXISTING
Is there some way? Or maybe a workaround to do:
WAIT SECONDS=1
URL GOTO=https://en.wikipedia.org/wiki/Main_Page
WAIT SECONDS=1
GOTO LINE=1 <----NOT EXISTING

Answer provided by Shugar:
SET next "MacroNameToRestart"
SET S EVAL("('{{!LOOP}}' == 1) ? 'imacros://run/?m={{next}}.iim' : 'javascript:undefined;';")
URL GOTO={{S}}

Related

IMacros If then else statement how to?

I am trying to make a script to automatically skip males and couples on a chat site, when i reach a couple the class is gndr_couple and the script returns an error and stops.
This is my current code:
VERSION BUILD=844 RECORDER=CR
FRAME F=1
WAIT SECONDS=0.5
TAG POS=1 TYPE=DIV ATTR=CLASS:gndr_male
WAIT SECONDS=0.2
TAG POS=1 TYPE=BUTTON ATTR=ID:right_button

unable to make a facebook post using iMacros

I made a script on iMacros using normal recording mode to make a wall post, but it doesn't seem to be recording the content to pasted on my wall though..
This is the code I wrote using the normal mode
TAG POS=1 TYPE=DIV ATTR=CLASS:_1mf<SP>_1mj EXTRACT=TXT
The above is able to extract contents from the post message field, however I'm unable to make it type contents into the same field... :(
Now, I have tried using EVENT recording mode and I am still facing issues.. Here is my code:
EVENT TYPE=MOUSEDOWN SELECTOR="#u_0_16" BUTTON=0
EVENT TYPE=MOUSEUP POINT="(386,118)"
EVENT TYPE=KEYPRESS SELECTOR="#js_gy>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV" CHAR="d"
EVENTS TYPE=KEYPRESS SELECTOR="#js_gy>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV>DIV" CHARS="Pasting Sample Content"
What am i doing wrong? :O :O
I don't know why you're still facing issues. So for example, try to play these lines:
TAG POS=1 TYPE=DIV ATTR=CLASS:_1mf<SP>_1mj EXTRACT=TXT
EVENT TYPE=CLICK SELECTOR="DIV[CLASS='_1mf _1mj']" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="DIV[CLASS='_1mf _1mj']" CHARS={{!EXTRACT}}

Imacros eval firefox

Currently using Imacros and got a problem, Im using
VERSION BUILD=8961227 RECORDER=FX
Windows 7
Firefox 44.0.1
Im trying to make something for instagram and Id like if it says follow then it will set the wait time to 30, if it says following it will change the Variable 7 to 0, so far the program will run but it will accept the if statement no matter if it says follow or following and set the wait time to 30, it wont pass it on to the else statement, any solutions?
VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 10
URL GOTO=https://www.instagram.com/instagram/
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL
SET !VAR3 Follow
SET !VAR4 Following
SET !VAR7 EVAL("if (\"{{VAR0}}\" == \"{{VAR3}}\") {VAR7= 5;} else {VAR7= 0;}; ")
wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow
wait seconds = {{!VAR7}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>VAR0:<SP>_{{!VAR0}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_<BR>VAR4:<SP>_{{!VAR4}}_<BR><BR>VAR7:<SP>_{{!VAR7}}_
Try this EVAL statement:
SET !VAR7 EVAL("('{{!VAR0}}' == '{{!VAR3}}') ? 30 : 0;")

Get number of elements in Imacros

There are 10 li tags in an html. I need the number to use it with a loop in a vbs file.
I tried this simple code but it didn't work, even in firefox extension
URL GOTO=javascript:document.getElementsByClassName('movableListItem').length;
One can try the code below to set the built-in variable !EXTRACT to the number of image tags in a document. And your question is similar.
SET !EXTRACT_TEST_POPUP NO
URL GOTO=javascript:{window.document.getElementsByTagName("img").length}
URL GOTO=javascript:{window.history.back()}
TAG POS=1 TYPE=HTML ATTR=* EXTRACT=TXT
BACK
Imacros can do it but you need to make a loop and catch the first error. It's kinda complicated for just this simple question but in Selenium IDE just do this:
Command: storeCssCount
Target : css=a
Value : n
And that's all. A single line of code

I am using i-macro on a website to perform different actions on a site

I want i-macro to do something like this:
1 - go to specific url like: http://www.xyz.com
2 - if there is an error in loading the url, then perform this thing
TAG POS=1 TYPE=IMG ATTR=SRC:http://www.xyz.com
3 - else load the page
my question is how can i accomplish this task
Since there is no IF statement in imacros you'll need to use javascript (for example). the code would be like this:
var ret=iimPlay("code:url goto=http://xyz.com");
if (ret<0){
iimPlay("code:TAG POS=1 TYPE=IMG ATTR=SRC:http://www.xyz.com");
}
else{
iimPlay("code:refresh");
}
save it as js file and run in firefox imacros.