Play (loop) in VB script

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.

Moderator: iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Play (loop) in VB script

by CSBE on Mon Jul 30, 2012 9:20 am

Version: V8.02.1970
Windows 7
Firefox & IE8/9
Included code works
VBS example scripts works OK


I have the following VB code:

Code: Select all
Option Explicit
Dim iim1, iret

'****
' find current folder
Dim macrolocation
macrolocation = "C:\IMACROS INPUT\#Current.iim"

set iim1= CreateObject ("imacros")
iret = iim1.iimInit ("-IE -V7", false)

if iret < 0 then MsgBox ("For this example to work you must make sure that the iMacros Add-On is **open** (visible) before you close Internet Explorer. Then the iMacros Add-On is started automatically whenever IE starts and the Scripting Interface can connect to it.")

iret = iim1.iimDisplay("Performancetestscript started")
 
'Run first macro
iret = iim1.iimPlay(macrolocation, 120)
if iret < 0 Then
   MsgBox "Error code: "+cstr(iret) + VbCrLf + "Error Text: "+iim1.iimGetLastError()
End If

iret = iim1.iimDisplay("Performancetestscript completed")

iim1.iimExit(30)
WScript.Quit(iret)


Would like to loop de script #current.iim 5 times in a row. Its like I would have add on imacros player open and use the Play (Loop) button. Can't seem to find a online solution. Must be very simple but I can't seem to find it. Please remember that in the iim script im using a csv file.

So what I am trying to do is do a full loop of the macro.

I found out this makes it loop, but it actually presses de play button instead of play loop button

Code: Select all
'Sample code A
Dim macrolocation, iim1, iret
macrolocation = "C:\IMACROS INPUT\Performancetestscript.iim"
Set iim1= CreateObject ("imacros")
For m = 1 to 3
iret = iim1.iimInit ("-IE", false)
    iret = iim1.iimInit()
    iret = iim1.iimPlay(macrolocation, 120)
Next
    iret = iim1.iimExit()
CSBE
 
Posts: 3
Joined: Mon Jul 30, 2012 7:29 am

Re: Play (loop) in VB script

by CSBE on Mon Jul 30, 2012 2:00 pm

Nevermind I already found the solution.

Thanks anyways
CSBE
 
Posts: 3
Joined: Mon Jul 30, 2012 7:29 am

Re: Play (loop) in VB script

by vega on Tue Jul 31, 2012 5:33 am

Can you please tell the solution, i have the same problem.



CSBE wrote:Nevermind I already found the solution.

Thanks anyways
vega
 
Posts: 1
Joined: Tue Jul 31, 2012 5:29 am

Re: Play (loop) in VB script

by CSBE on Fri Aug 03, 2012 12:26 pm

vega wrote:Can you please tell the solution, i have the same problem.



CSBE wrote:Nevermind I already found the solution.

Thanks anyways


Use the following:
Code: Select all
Dim macrolocation, iim1, iret
' Locatie waarscript zich bevind
macrolocation = "C:\YOURSCRIPT.iim"

' Om te werken met iMacros
Set iim1= CreateObject ("imacros")
' Tels what row it should get values. Note that the the code underneath will run row 2 3 and 4. This would mean 3 RUNS.
For m = 2 to 4

' Pick either IE or Firefox browser. Imacros is also possible but you can find this yourself I bet
' Internet Explorer --> iret = iim1.iimInit ("-IE", false)
' Firefox --> i = iim1.iimInit ("-fx", true)
i = iim1.iimInit ("-fx", true)
   iret = iim1.iimInit()
   iret = iim1.iimSet("row", m)
' 9999 think is the amount of time it continues running script. But don't know for sure. I put it very high so it wont close and it worked.
   iret = iim1.iimPlay(macrolocation, 9999)
   iret = iim1.iimExit()
Next


Don't have a lot experience with it yet, but this is the most basic script. You can find most information at the following link:
http://wiki.imacros.net/Keyword_Search#Q:_How_can_I_search_for_a_specific_keyword_on_a_web_page.3F
Look for: Q: How can I set up a 24 hours a day, 7 days a week (non-stop) operation with iMacros?
CSBE
 
Posts: 3
Joined: Mon Jul 30, 2012 7:29 am


Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: No registered users and 3 guests

Website Monitoring