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

I found "iret" in imacros wiki. What is it?

Discussion in 'Other Scripting Languages' started by hillz, Mar 3, 2014.

  1. hillz

    hillz Registered Member

    Joined:
    Aug 14, 2011
    Messages:
    54
    Likes Received:
    3
    In this page on the bottom there's this code:

    Code:
    Dim imacros, iret, i Set imacros = CreateObject("imacros") 
    iret = imacros.iimInit() 
    For i=0 To 4  
      ' You have to convert the value into a string! 
      iret = imacro.iimSet("myloop", CStr(i)) 
      iret = imacros.iimPlay("mymacro") 
    Next
    Oh and another one:

    Code:
    iret = imacro.iimSet("greeting", "hello") iret = imacros.iimPlay("1st-macro") 
     
    iret = imacro.iimSet("greeting", "hello") 
    iret = imacros.iimPlay("2nd-macro")
    On the top there's also this code:

    Code:
    int ret_code = iimSet ( String VARNAME, String VARVALUE )
    Can you explain what these commands do:
    1. int ret_code
    2. iret
    3. Set imacros = CreateObject("imacros")
    4. Init()
    5. Dim imacros, iret, i
    6. imacro.iimSet("myloop", CStr(i)) pls explain the word in bold

    I suppose they are javascript commands but when I googled them I couldn't find any explanations. It would be best if you could also explain every line.

    Thank you very much :D .
     
  2. chillout1989

    chillout1989 Newbie

    Joined:
    Oct 8, 2013
    Messages:
    16
    Likes Received:
    2
    At first i want to say that i just can code javascript, but this is Visual Basic.

    I think the "int ret_code" and "iret" means the same in javascript.
    It's a variable which returns a number, depending on the success of the macro you played. If the macro gets an error, the variable iret stores the error code. If the macro was successfully played, the number is 1. Look on google + imacros error return codes (i cant post links here..)
    That's very helpful to handle errors. I use this for example to check if something on a page exists or not.

    imacro.iimSet("myloop",CStr(i))
    This transfers a variable into your macro. In this case you have to call the variable inside the macro with {{myloop}}. The String, Number or whatever is stored in that value is CStr(i) which had to be defined before playing the macro. I think its an array, but like i said i don't know anything about Visual Basic :p

    The others.. No idea.. :) But there should be some entries in the wiki about that,too. Or look in the official forum of iopus.
     
  3. hillz

    hillz Registered Member

    Joined:
    Aug 14, 2011
    Messages:
    54
    Likes Received:
    3
    Thank you, I was mistaken I thought it was JS. Perhaps that's why I couldn't find the answer on google