continue from certain script line

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
1neumanbnand
Posts: 9
Joined: Thu Nov 10, 2011 8:47 pm

continue from certain script line

Post by 1neumanbnand » Thu Nov 10, 2011 9:10 pm

Hello.

I have this problem, I need to make a script that takes 1 certain line of script every once and a while:
example: the lines of a scrips shows like this:

1 VERSION BUILD=7401004 RECORDER=FX
2 TAB T=1
3 URL GOTO=http://www.osta.ee/index.php?fuseaction ... d=22584371
4 TAG POS=1 TYPE=B ATTR=TXT:Kasuta<SP>põhjana<SP>(uuesti<SP>müüki)
5 TAG POS=1 TYPE=A ATTR=TXT:Täpsusta<SP>oksjoni<SP>kestvust<SP>+
6 TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=ID:duration CONTENT=%3
7 TAG POS=1 TYPE=A ATTR=ID:tab-descr
8 TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:index.php?fuseaction= ATTR=ID:use-2nd-cat CONTENT=YES
9 pause
10 TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:sell-form ATTR=NAME:go-forward&&VALUE:Edasi<SP>>>
11 TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:sell-form ATTR=NAME:go-forward&&VALUE:Edasi<SP>>>
12 TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:sell-form ATTR=NAME:go-forward&&VALUE:Oksjon<SP>valmis<SP>>>

so, how it needs to be: this code needs to loop 10 times, but instead of PAUSE row, there is going to be 2 selections, they need to be certain selections from a drop down menu, they have to be diferent on every loop.

I need to use this script on many different URL-s, so my idea is, that im going to record this whole thing as one macro. basically 10 times loop with diferent selections from drop down every time, and I need to find a way, how I can use the same url in all those loops, without editing all 10 URL rows..

in the code I want to link the 3-rd row of the code (URL) to every next loop, so I get a big script but I need to change only the 3-rd row of it, if I need to use it on some other page(URL), not

Im not very good at english, but I hope that my story here makes sence
1neumanbnand
Posts: 9
Joined: Thu Nov 10, 2011 8:47 pm

Re: continue from certain script line

Post by 1neumanbnand » Thu Nov 10, 2011 9:17 pm

basic idea, simplified:

1 VERSION BUILD=7401004 RECORDER=FX
2 TAB T=1
3 URL GOTO=http://www.osta.ee/index.php?fuseaction ... d=22584371
4 do this
5 do that
6 select dropdown 1
7 continue
8 next
9 done
10 TAB T=1
11 LINK TO ROW NUMBER 3 in this script
12 do this
13 do that
14 select dropdown 2
15 continue
16 next
17 done
18 TAB T=1
19 LINK TO ROW NUMBER 3 in this script
... and so on..


* Im not sure that if TAB T=1 is required every time ( like I wrote here on row 10 and 18)
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: continue from certain script line

Post by Daniel, Tech Support » Thu Nov 10, 2011 9:47 pm

Hi,

Correct me if I got this wrong: all you need is to get this macro select a different drop-down option on line 9 (instead of '9 pause') on each iteration. I.e. have it run 10 times, do the same thing every time, the only difference being the drop-down option in 9? If so, then you could do it using looping and csv input. Let me know if this is what you need and I'll give you more details.

Best regards,
Daniel, iOpus Support
1neumanbnand
Posts: 9
Joined: Thu Nov 10, 2011 8:47 pm

Re: continue from certain script line

Post by 1neumanbnand » Fri Nov 11, 2011 5:05 am

Thats correct,

actually, it has to select data from dropdown menu, then subcategorys are displayed on another dropdown menu and it has to select data from there also. after that click on a tickbox to enable another dropdown menu and do the same, only with different data

it is an auction site and I have to sell an item that fits in to many categorys.. inserting one auction, You can set it to show up in 2 different categorys. I need to be visible in more categorys, so I need to open about 10 auctions sometimes.
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: continue from certain script line

Post by Daniel, Tech Support » Fri Nov 11, 2011 4:31 pm

Hi,

I see! In this case I suggest you add the drop-down options to a .csv file, like
option1_1 option1_2
option2_1 option2_2
option3_1 option3_2
...

Then add this to the beginning of the macro:

Code: Select all

SET !DATASOURCE path_to_csv_file.csv 'or just file name if the file is in default 'sources' folder - see iMacros settings
SET !DATASOURCE_COLUMNS 2
SET !DATASOURCE_LINE {{!LOOP}} 'here you indicate that the current iteration number should be used as a line number, i.e. process line 3 of the csv file on 3rd iteration
then goes your macro, and instead of the line 9 you would have something like:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:select1 CONTENT=${{!COL1}} 'Use value of the 1st column of the .csv file
TAG POS=1 TYPE=SELECT ATTR=NAME:select1 CONTENT=${{!COL2}} 'Use value of the 2nd column of the .csv file
You might possibly need to add WAIT SECONDS=1 between the 2 lines above, if the 2nd drop down needs time to update, after the 1st one was selected.

More info can be found here:
http://wiki.imacros.net/Tutorials#CSV_input

Please note also that you will have to press 'Play (loop)' button of iMacros instead of regular play. You will also have to set the number of csv file lines in the textbox above the 'Play (loop)' button.

Best regards
Daniel, iOpus Support
1neumanbnand
Posts: 9
Joined: Thu Nov 10, 2011 8:47 pm

Re: continue from certain script line

Post by 1neumanbnand » Fri Nov 11, 2011 5:30 pm

umm well, when selecting data from the dropdown, the macro code looks like this: (I changed the font colour to blue in the dropdown section of the code)

VERSION BUILD=7401004 RECORDER=FX
TAB T=1
URL GOTO=http://www.osta.ee/?fuseaction=myitems.info&id=22584371
TAG POS=1 TYPE=B ATTR=TXT:Kasuta<SP>põhjana<SP>(uuesti<SP>müüki)
TAG POS=1 TYPE=A ATTR=ID:tab-descr
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:index.php?fuseaction= ATTR=ID:use-2nd-cat CONTENT=YES
TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=NAME:main_category1_id CONTENT=%1434
TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=ID:category1_id CONTENT=%1439
TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=NAME:main_category2_id CONTENT=%1419
TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=ID:category2_id CONTENT=%143

TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:sell-form ATTR=NAME:go-forward&&VALUE:Edasi<SP>>>
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:sell-form ATTR=NAME:go-forward&&VALUE:Edasi<SP>>>

how it would look like in a csv file? do I get this right, that simplest way to make a .csv is to use excel?

sorry if it is a dumb question, but im all new in this programming/scripting thing and it seems quite complicated at the moment.

Best regards,
Andres
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: continue from certain script line

Post by Daniel, Tech Support » Fri Nov 11, 2011 6:17 pm

Hi Andres,

Have a look here:
http://wiki.imacros.net/TAG#Special_TAG ... Down_Menus

Basically you can replace the %1434 with $actual_name_of_the_option. Those names are of course much easier to store in a .csv than numbers.

Best regards,
Daniel, iOpus Support
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: continue from certain script line

Post by Daniel, Tech Support » Fri Nov 11, 2011 6:19 pm

P.S. Yes, Excel is simplest, but you could also use notepad if you wish. Most important is that the resulting file follows this format description: http://wiki.imacros.net/csv
Daniel, iOpus Support
1neumanbnand
Posts: 9
Joined: Thu Nov 10, 2011 8:47 pm

Re: continue from certain script line

Post by 1neumanbnand » Fri Dec 09, 2011 1:12 pm

hey again,

I had no time to deal with this meanwhile, but today, when I tried, I couldńt get it to work.. it tells me:

Error: Component returned failure code: 0x80500001 [nsIConverterInputStream.init], line: 2 (Error code: -1001)

my code is:

Code: Select all

VERSION BUILD=7401004 RECORDER=FX
set !DATASOURCE multif.csv
SET !DATASOURCE_COLUMNS 4
SET !DATASOURCE_LINE {{!LOOP}}
TAB T=1
URL GOTO=http://www.osta.ee/index.php?fuseaction=myitems.info&id=22559910
TAG POS=1 TYPE=B ATTR=TXT:Kasuta<SP>põhjana<SP>(uuesti<SP>müüki)
TAG POS=1 TYPE=A ATTR=ID:tab-descr
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:index.php?fuseaction= ATTR=ID:use-2nd-cat CONTENT=YES
TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=NAME:main_category1_id CONTENT=${{!COL1}}
TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=ID:category1_id CONTENT=${{!COL2}}
TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=NAME:main_category2_id CONTENT=${{!COL3}}
TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=ID:category2_id CONTENT=${{!COL4}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:sell-form ATTR=NAME:go-forward&&VALUE:Edasi<SP>>>
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:sell-form ATTR=NAME:go-forward&&VALUE:Edasi<SP>>>
and "multif.csv" looks like this, when opened in notepad:


arvutid,komponendid,arvutid,korpused
arvutid,muu,arvutid,lauaarvutid
arvutid,lisaseadmed ja tarvikud,arvutid,süle- ja pihuarvutid
audio/video,heli ja showtehnika,audio/video,muu elektroonika
audio/video,stereoseadmed,audio/video,raadioamatööride tehnika
autovaruosad,auto lisaseadmed,autovaruosad,autode helitehnika
autovaruosad,motorollerite ja mopeedide varuosad,autovaruosad,sõiduautode ja maasturite varuosad
ehitusmaterjalid,ehitus- ja viimistlusmaterjalid,ehitusmaterjalid,elektrimaterjalid
harrastused ja vaba aeg,muud harrastused,kodu,lambid ja peeglid
kodu,muud kodutarbed,kontori ja äritarbed,kaupluse sisustus
tööriistad ja masinad,elektriseadmed,varia,muu
äri ja teenused,äri ja firmatarbed,äri ja teenused,hulgimüük


if I understand correctly, then my CSV is bad, but I cant understand why.. so I tried some random CSV example file, compared them but no luck.. script runs flawlessly untill it needs to select values with this sample:

1,George Washington,http://en.wikipedia.org/wiki/George_Was ... ndependent ,GeorgeWashington.jpg,thmb_GeorgeWashington.jpg,Virginia
2,John Adams,http://en.wikipedia.org/wiki/John_Adams ... Federalist ,JohnAdams.jpg,thmb_JohnAdams.jpg,Massachusetts
3,Thomas Jefferson,http://en.wikipedia.org/wiki/Thomas_Jef ... Republican ,ThomasJefferson.jpg,thmb_Thomasjefferson.gif,Virginia
4,James Madison,http://en.wikipedia.org/wiki/James_Madi ... Republican ,JamesMadison.jpg,thmb_JamesMadison.gif,Virginia
5,James Monroe,http://en.wikipedia.org/wiki/James_Monr ... Republican ,JamesMonroe.gif,thmb_JamesMonroe.gif,Virginia


im sure its just some dumb mistake I made but cant figure out what exactly.
1neumanbnand
Posts: 9
Joined: Thu Nov 10, 2011 8:47 pm

Re: continue from certain script line

Post by 1neumanbnand » Fri Dec 09, 2011 2:03 pm

well, I have figured out the reason, I guess:

if there is some characters like ü, õ, ä, ö or ». then imacros dont accept it.

but what can I do to solve it. there are words like: äri and hulgimüük. also some values have » marks in front of them, to mark sub-subcategory. I also have to use theese marks, otherwise imacros wont recognize the value and wont select it on webpage.

is there anything I can do about it? can I replace ü letter with something to make it understandable for imacros?
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: continue from certain script line

Post by Daniel, Tech Support » Mon Dec 12, 2011 10:28 pm

Hi,

Before I start digging to deep, could you please tell me if multif.csv is stored in the right folder (imacros datasources)?

Best regards,
Daniel, iOpus Support
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: continue from certain script line

Post by Daniel, Tech Support » Mon Dec 12, 2011 10:30 pm

well, I have figured out the reason, I guess:

if there is some characters like ü, õ, ä, ö or ». then imacros dont accept it.
Why do you think so? Did csv without these characters work? If so, try converting your csv to UTF-8.
You can do this easily with Windows Notepad (select Save As and choose UTF-8 for the encoding) or a free text editor like Notepad++.
Daniel, iOpus Support
1neumanbnand
Posts: 9
Joined: Thu Nov 10, 2011 8:47 pm

Re: continue from certain script line

Post by 1neumanbnand » Wed Dec 14, 2011 12:26 pm

thanks for the encoding tip! with UTF-8, it accepts the CSV file always..

EDIT: itś also in the correct folder

but I still can´t get past selecting " » Korpused"
If I have standard character input like "arvutid" (computers) as a category and "komponendid" (components) as a subcategory. then my CSV and Imacros run fine and do their job. but if I get to subcategory " » Korpused" (computer cases, and some fancy character in front of it). then things come to stop. it seems like it does not recognise any entry in the select box, compared to CSV input.

I used firebug tool to inspect the select box. if I move my cursor to this value, it says:

"<option value="1067">&nbsp;»&nbsp; Korpused</option>" (without the quotes at the beginning and end)

and I have tried all possible values in my CSV, including:

&nbsp;»&nbsp; Korpused
&nbsp;»&nbsp;*Korpused
*»**Korpused
*Korpused
**Korpused
***Korpused
****Korpused
*****Korpused
******Korpused
******orpused
" » "Korpused
" » Korpused"
and many more, that I can´t recall atm.

If I use Imacros Recording, then selecting this value gives me this code in macro:

TAG POS=1 TYPE=SELECT FORM=ACTION:index.php?fuseaction= ATTR=ID:category2_id CONTENT=%1067

So I have also tried to add "CONTENT=%1067" to my CSV. but it still wont select it.. it does itś job, selects "arvutid","komponendid" as first selling category, then selects "arvutid" from the second category but wont select "korpused".. tries 40 seconds and gives me this error every time:

RuntimeError: Selected entry not available: '${{!COL4}}' [Box has 19 entries], line: 13 (Error code: -924)

so I´m out of ideas, and out of time for today.. I hope somebody knows, what I´m doing wrong.

EDIT2:

Just in case, this is my CSV file atm:

col1,col2,col3,col4
arvutid,komponendid,arvutid,*»**Korpused
arvutid,muu,arvutid,lauaarvutid
arvutid,lisaseadmed ja tarvikud,arvutid,süle- ja pihuarvutid
audio/video,heli ja showtehnika,audio/video,muu elektroonika
audio/video,stereoseadmed,audio/video,raadioamatööride tehnika
autovaruosad,auto lisaseadmed,autovaruosad,autode helitehnika
autovaruosad,motorollerite ja mopeedide varuosad,autovaruosad,sõiduautode ja maasturite varuosad
ehitusmaterjalid,ehitus- ja viimistlusmaterjalid,ehitusmaterjalid,elektrimaterjalid
harrastused ja vaba aeg,muud harrastused,kodu,lambid ja peeglid
kodu,muud kodutarbed,kontori ja äritarbed,kaupluse sisustus
tööriistad ja masinad,elektriseadmed,varia,muu
äri ja teenused,äri ja firmatarbed,äri ja teenused,hulgimüük
Last edited by 1neumanbnand on Wed Dec 14, 2011 12:37 pm, edited 1 time in total.
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: continue from certain script line

Post by Daniel, Tech Support » Wed Dec 14, 2011 12:34 pm

Hi,

What if you try *${{!COL4}} instead of ${{!COL4}}?

Best regards,
Daniel, iOpus Support
1neumanbnand
Posts: 9
Joined: Thu Nov 10, 2011 8:47 pm

Re: continue from certain script line

Post by 1neumanbnand » Wed Dec 14, 2011 11:12 pm

hey,

looks like it stops the macro at the point it reaches *${{!COL4}} I also got this error:

RuntimeError: Wrong format of CONTENT value, line: 13 (Error code: -1001)

I tried this also:
manually tried to select same things for both selling categorys, now that I know itś possible, I edited my CSV. resulting first lines like this:

col1,col2,col3,col4
arvutid,komponendid,arvutid,komponendid

so I can´t have the character problem in this case. but it still did not use col4 value to select "komponendid" as my second selling category.

I´m going to re-do all this macro from scratch tomorrow. trying to eliminate my possible error.

Regards,
Andres
Post Reply