NEED HELP with Imacros Script.

ANITechnologies

Registered Member
Joined
Jun 1, 2013
Messages
75
Reaction score
21
Hey,


I have the following Imacros code but it stops working every time the website generates a HTTP error such as a 503 or a 500. I don't want that to happen, I want the code to continue and retry to access the website in the next loop.

Code:
VERSION BUILD=8300326 RECORDER=FX
SET !ERRORIGNORE YES

SET !TIMEOUT_PAGE 2

CLEAR
URL GOTO=http://base.pk

Please help :3
Thank you.
 
Well, it is not the best solution, but you may try this .vbs code:


Code:
Set imacros = CreateObject("imacros")
iret = imacros.iimInit() 
MyMacroCode = "CODE:"
MyMacroCode = MyMacroCode+"URL GOTO=website/ " + vbNewLine 
MyMacroCode = MyMacroCode+"TAG POS=1 TYPE=LI ATTR=ID:causeNotConnected EXTRACT=TXT" + vbNewLine
iret = imacros.iimPlay(MyMacroCode)


extracted = imacros.iimGetLastExtract 
MsgBox extracted
offline = InStr(extracted,"You are not connected to the Internet.")


If offline>0 Then 


MsgBox "site doesn't work, Imacros will wait 3 sec and refresh"
MyMacroCode = "CODE:"
MyMacroCode = MyMacroCode+"WAIT SECONDS=3" + vbNewLine 
MyMacroCode = MyMacroCode+"REFRESH" + vbNewLine 
iret = imacros.iimPlay(MyMacroCode) 


Else


MsgBox "site works, Imacros will do cool stuff"
MyMacroCode = "CODE:"
MyMacroCode = MyMacroCode+"TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT=imacros<SP>rocks! " + vbNewLine 
MyMacroCode = MyMacroCode+"TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f ATTR=NAME:btnG " + vbNewLine
iret = imacros.iimPlay(MyMacroCode)
End If


The script checks if the page has text "You are not connected to the Internet"
If it is there it waits 3 seconds and does REFRESH
If it is not there it just goes on and does whatever you want (if needed)

You may also chech the imacros wiki, there are explained the timeout tags, and are set the custom errors (500, 503, etc.)
 
Back
Top