Loop problem with iimgetlastextract using VBS

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++.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
LSnelson
Posts: 17
Joined: Thu Jan 29, 2009 6:02 pm

Loop problem with iimgetlastextract using VBS

Post by LSnelson » Thu Jan 29, 2009 6:16 pm

Any idea of why this doesn't work?? All I can get is NODATA in this VB script. This is just a snippet. The "count" variable doesn't seem to work. A hardcoded number works fine.

'run the macro here first

Dim count

For count = 0 to 3

s = iim1.iimGetLastExtract(count)
msgbox (s)

Next


Thanks,
Larry
Marcia, Tech Support
Posts: 1094
Joined: Thu Jan 29, 2009 1:10 pm

Re: Loop problem with iimgetlastextract using VBS

Post by Marcia, Tech Support » Tue Feb 03, 2009 9:54 pm

Hello,

iimGetLastExtract() expects an integer value as argument, so count should be converted into integer before being passed. Your code should work by simply substituting count by CInt (count) in the argument of iimGetLastExtract:
  • Dim count
    For count = 0 to 3
    s = iim1.iimGetLastExtract( CInt (count))
    msgbox (s)
    Next
Regards,

Marcia
LSnelson
Posts: 17
Joined: Thu Jan 29, 2009 6:02 pm

Re: Loop problem with iimgetlastextract using VBS

Post by LSnelson » Wed Feb 04, 2009 4:01 pm

Aha! I knew it must be something simple. I will try Cint and advise.

Thanks
LSnelson
Posts: 17
Joined: Thu Jan 29, 2009 6:02 pm

Re: Loop problem with iimgetlastextract using VBS

Post by LSnelson » Mon Mar 09, 2009 7:31 pm

Just got back on this project and unfortunately still having a problem with array element addressing.

I have an array loaded with stock symbols. Below is a code snippet:

CODE:
/*******************************************
1. For Element 0 to ubound(MyArray)

2. macro = macro+ "URL GOTO=http://www.stocks.com/q=" & MyArray(cint(Element))+vbNewLine

3. Next
*********************************************/

Line 2 is the problem. When the macro goes to the website the stock symbol part of the URL string is blank. I can use MyArrary(0) and it works fine as well as MyArray(1) etc. Trying to use a variable for the array element number is the problem. I can use the syntax in line 2 in a msgbox and it displays the data without a problem, i.e. : msgbox(MyArray(cint(Element)))

Any ideas of why the syntax aboe will not work?

Thanks,
Larry
Marcia, Tech Support
Posts: 1094
Joined: Thu Jan 29, 2009 1:10 pm

Re: Loop problem with iimgetlastextract using VBS

Post by Marcia, Tech Support » Mon Mar 09, 2009 8:02 pm

Hello,

It is difficult to say something when I do not know what is MyArray(Element). Is it a number?

In any case, one should be aware of using the plus sign (+) to concatenate two character strings as explained in the VBScript language reference.
Regards,

Marcia
Post Reply