Simple non-code loop, Possible?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
jmwhite411
Posts: 7
Joined: Wed Dec 03, 2008 3:51 pm

Simple non-code loop, Possible?

Post by jmwhite411 » Wed Dec 03, 2008 4:41 pm

I have read all(most) the Forum and FAQ on the topic of looping, but since I do not know any code language or how to write in it I am at a loss. I would like to be able to create a simple loop, within the Imacro iim file, that will click a value from a combobox and then move it using an arrow key. I would like this to happen over and over until there are no more values in the combobox. There is not a set number of values so I need to have the loop check for : "Selected entry not available:0 [Box has -1 entries]"(this shows in the upper left pink box when no value is found).

Right now I have just copied the statement below 25 times and have SET !ERRORIGNORE YES so it speed bumps but this is huge waste of time. I am unable to pull the values from the Combobox(tried EXTRACT and it did not work).

The simple function would need to contain only the following lines.
TAG POS=1 TYPE=SELECT FORM=NAME:ComboBoxForm ATTR=NAME:list3 CONTENT=0
TAG POS=2 TYPE=IMG ATTR=HREF:https://***Websitename***.adpmrs.com/images/arrow_right.gif

I cant move the CONTENT= from 0 to X(6 in this example) in order to scroll through the list because i get "Selected entry not available:6 [Box has 2 entries]" over and over.
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: Simple non-code loop, Possible?

Post by Tech Support » Thu Dec 04, 2008 12:42 am

For simple loops ( = repeat the same macro again and again) you can start the macro with the LOOP button.

Example: Delete SPAM email with iMacros
jmwhite411
Posts: 7
Joined: Wed Dec 03, 2008 3:51 pm

Re: Simple non-code loop, Possible?

Post by jmwhite411 » Thu Dec 04, 2008 3:42 am

I use this feature frequently and in fact already with this macro. My question was more to the idea of a loop within a macro. The Macro itself uses the Play Loop about 1000 times.

I need to know how to create a loop inside a macro(without using some code language but right in the iim file)... not loop a macro.
jmwhite411
Posts: 7
Joined: Wed Dec 03, 2008 3:51 pm

Re: Simple non-code loop, Possible?

Post by jmwhite411 » Thu Dec 04, 2008 8:59 pm

Just to give the full picture, this is the whole macro which is set to run using the Play[Loop] button:
TAB CLOSEALLOTHERS
SET !TIMEOUT 30
SET !ENCRYPTION NO
SET !ERRORIGNORE YES
SET !DATASOURCE list.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !EXTRACT_TEST_POPUP NO
'Login to Website
URL GOTO=https://***Website***.adpmrs.com/
TAG POS=1 TYPE=SELECT FORM=NAME:CFForm_1 ATTR=NAME:username CONTENT=19
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:CFForm_1 ATTR=NAME:PASSWORD CONTENT=********
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:CFForm_1 ATTR=NAME:submit
TAB T=1
'Look up the specific file
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:quick_search_form ATTR=NAME:search_claim_number CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:quick_search_form ATTR=VALUE:Go
FRAME F=1
'Open the file
TAG POS=1 TYPE=IMG ATTR=HREF:https://***Website***.adpmrs.com/images/mailicon.gif
WAIT SECONDS=3
TAB T=2
FRAME F=0
'Set up the file for email contents
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ComboBoxForm ATTR=NAME:claim_number CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:ComboBoxForm ATTR=VALUE:Attach/Print
WAIT SECONDS=5
'Dont know how to loop to attach photos but this method does not error if the POS is not defined
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:ComboBoxForm ATTR=NAME:AttachImage&&VALUE:* CONTENT=YES
TAG POS=2 TYPE=INPUT:CHECKBOX FORM=NAME:ComboBoxForm ATTR=NAME:AttachImage&&VALUE:* CONTENT=YES
WAIT SECONDS=2
'Need to loop to attach because this section shows errors and then ERRORIGNORE speedbumps it if there is nothing to move
'this takes to much time and the ERRORIGNORE fires for each failure
TAG POS=1 TYPE=SELECT FORM=NAME:ComboBoxForm ATTR=NAME:list3 CONTENT=0
TAG POS=2 TYPE=IMG ATTR=HREF:https://anchorgeneral.adpmrs.com/images/arrow_right.gif
TAG POS=1 TYPE=SELECT FORM=NAME:ComboBoxForm ATTR=NAME:list3 CONTENT=0
TAG POS=2 TYPE=IMG ATTR=HREF:https://anchorgeneral.adpmrs.com/images/arrow_right.gif
TAG POS=1 TYPE=SELECT FORM=NAME:ComboBoxForm ATTR=NAME:list3 CONTENT=0
WAIT SECONDS=2
'Once items are attached send email
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:ComboBoxForm ATTR=VALUE:Send<SP>Email
WAIT SECONDS=2
'Logout
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:ComboBoxForm ATTR=NAME:close
Last edited by jmwhite411 on Thu Dec 18, 2008 11:39 pm, edited 1 time in total.
mknoll1
Posts: 174
Joined: Fri Dec 23, 2005 4:14 pm

Re: Simple non-code loop, Possible?

Post by mknoll1 » Fri Dec 05, 2008 3:13 pm

jmwhite411 wrote:
The simple function would need to contain only the following lines.
TAG POS=1 TYPE=SELECT FORM=NAME:ComboBoxForm ATTR=NAME:list3 CONTENT=0
TAG POS=2 TYPE=IMG ATTR=HREF:https://***Websitename***.adpmrs.com/images/arrow_right.gif

I think this will work is you want all of the options in the box:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:ComboBoxForm ATTR=NAME:list3 CONTENT=ALL
TAG POS=2 TYPE=IMG ATTR=HREF:https://***Websitename***.adpmrs.com/images/arrow_right.gif
No need to loop since it gets them all in one command.
jmwhite411
Posts: 7
Joined: Wed Dec 03, 2008 3:51 pm

Re: Simple non-code loop, Possible?

Post by jmwhite411 » Fri Dec 05, 2008 3:33 pm

I hate to be such a pain, but the =ALL only took the last one in the list. The problem with this combobox is that you can only take one item at a time and move it. There is no Select All or other option to choose everything for the combobox. It needs to be a repetitive looping process of : Click CONTENT=0 > click Arrow.gif, Click CONTENT=0 > Click arrow.gif... until there are no more 'CONTENT=0' and the macro gives the [Box has -1 entries] error then continue with rest of macro.

Is there no repitition(or a non-code version of a Do loop) that can be added into the iim file which can run in-line while the macro is working without using the play[loop] button?

How about a way to maybe break a string of commands... like when the macro sees an Error, say [Box has -1 entries] jump to a new point in the macro. If this is possible then I could keep all the repitition in the macro but once it hits the last one in the combobox, and errors, it will skip trying to click the CONTENT=0 and move on to the next part of the macro.
jmwhite411
Posts: 7
Joined: Wed Dec 03, 2008 3:51 pm

Re: Simple non-code loop, Possible?

Post by jmwhite411 » Wed Dec 17, 2008 9:54 pm

The missing link was how to use VBS scripts in windows. I never realized that if any of the code segments are pasted into a TXT file with an extension .VBS they will just play by double click in Windows.
jmwhite411
Posts: 7
Joined: Wed Dec 03, 2008 3:51 pm

Re: Simple non-code loop, Possible?

Post by jmwhite411 » Thu Dec 18, 2008 11:37 pm

To finish this post I wanted to show the Macro.VBS file I ended up with, which is working perfectly... maybe it could have some better error trapping, but its kind of a throw-away.

Option Explicit
Dim iim1, iret
set iim1 = CreateObject ("imacros")
iret = iim1.iimInit()
' Start first macro that just logs into the website. This is done outside the loop so it only happens once
iret = iim1.iimPlay("MacroLogin")
, Start the Outside loop which run 1000 times
Dim ClickNumber, m
ClickNumber = 0
For m = 1 to 1000
iret = iim1.iimInit()
, The Myloop variable is the .VBS version of the !LOOP and keeps my CSV file incrementing
iret = iim1.iimSet("myloop", Cstr(m))
, This macro Just finds a file and selects it. It could really do anything but it happens once per loop
iret = iim1.iimPlay("MacroFind-Select")
, Start of a inside loop that runs over and over until there are no more in the list
do while not iret < 0
ClickNumber = ClickNumber + 1
iret = iim1.iimSet("myloop2", Cstr(ClickNumber))
, This macro goes through a combobox list of items and selects the top one
iret = iim1.iimPlay("MacroClick")
loop

, This one does a final thing after the MacroClick fails out then the starts at the beginning of the Outside Loop
iret = iim1.iimPlay("MacroFinal")

Next
iret = iim1.iimExit()
Wscript.Quit()
******************____Code for MacroClick____________***************
TAB T=2
TAG POS=1 TYPE=SELECT FORM=NAME:ComboBoxForm ATTR=NAME:list3 CONTENT=0
TAG POS=2 TYPE=IMG ATTR=HREF:https://Website.adpmrs.com/images/arrow_right.gif
WAIT SECONDS=.5


**************************___________Code for MacroFind-Select_____________************
SET !ERRORIGNORE YES
SET !TIMEOUT 120
CMDLINE !DATASOURCE list.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{Myloop}}
SET !EXTRACT_TEST_POPUP NO
TAB T=1
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:quick_search_form ATTR=NAME:search_claim_number CONTENT={{!COL1}}
Post Reply