1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

NEED HELP with Imacros Script.

Discussion in 'General Scripting Chat' started by ANITechnologies, Nov 5, 2013.

  1. ANITechnologies

    ANITechnologies Registered Member

    Joined:
    Jun 1, 2013
    Messages:
    74
    Likes Received:
    21
    Home Page:
    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.
     
  2. fozzyh

    fozzyh Newbie

    Joined:
    Feb 25, 2010
    Messages:
    17
    Likes Received:
    5
    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.)