I still new in imacros, how to replace with loop for the list of set content
Here my code:
SET IMAGE1 C:\1.jpg
SET IMAGE2 C:\2.jpg
SET SEL1 612
SET SEL2 271
.
.
.
.
SET SEL50 602
'if possible the image i want to make random for image1 and image2
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_0 CONTENT={{IMAGE1}}
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_1 CONTENT={{IMAGE2}}
'this line of content will replace SEL1 until SEL50
TAG POS=1 TYPE=SELECT FORM=ID:formular ATTR=ID:test CONTENT=%{{SEL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:formular ATTR=ID:c_publish
'currently my code will repeat 50 time
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_0 CONTENT={{IMAGE1}}
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_1 CONTENT={{IMAGE2}}
TAG POS=1 TYPE=SELECT FORM=ID:formular ATTR=ID:test CONTENT=%{{SEL2}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:formular ATTR=ID:c_publish
.
.
.
thanks in advance
This should do the job, the code can be looped 50 times, it uses a data source called file_name.csv so create this and load the values of sel1 to sel50 in the first column. From my understanding of the question I have randomized image1 and image2 to toggle between two images.
Note: don't forget to change the path in line3 to the location of your CSV file.
CODE (UPDATED BASED ON NEW REQUIREMENT FROM COMMENTS BELOW):
VERSION BUILD=9030808 RECORDER=FX
SET !ERRORIGNORE YES
SET !DATASOURCE "C:/Users/Testing/Desktop/file_name.csv"
SET !DATASOURCE_COLUMNS 1
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !VAR1 EVAL("var randomImage=Math.random() >= 0.5 ? 'C:\1.jpg' : 'C:\2.jpg';randomImage;")
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_0 CONTENT={{!VAR1}}
SET !VAR1 EVAL("var randomImage=Math.random() >= 0.5 ? 'C:\1.jpg' : 'C:\2.jpg';randomImage;")
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_1 CONTENT={{!VAR1}}
SET !VAR1 EVAL("var randomImage=Math.random() >= 0.5 ? 'C:\1.jpg' : 'C:\2.jpg';randomImage;")
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_2 CONTENT={{!VAR1}}
SET !VAR1 EVAL("var randomImage=Math.random() >= 0.5 ? 'C:\1.jpg' : 'C:\2.jpg';randomImage;")
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_3 CONTENT={{!VAR1}}
SET !VAR1 EVAL("var randomImage=Math.random() >= 0.5 ? 'C:\1.jpg' : 'C:\2.jpg';randomImage;")
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_4 CONTENT={{!VAR1}}
SET !VAR1 EVAL("var randomImage=Math.random() >= 0.5 ? 'C:\1.jpg' : 'C:\2.jpg';randomImage;")
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_5 CONTENT={{!VAR1}}
SET !VAR1 EVAL("var randomImage=Math.random() >= 0.5 ? 'C:\1.jpg' : 'C:\2.jpg';randomImage;")
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_6 CONTENT={{!VAR1}}
'this line of content will replace SEL1 until SEL50
TAG POS=1 TYPE=SELECT FORM=ID:formular ATTR=ID:test CONTENT=%{{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:formular ATTR=ID:c_publish
CODE:
VERSION BUILD=9030808 RECORDER=FX
SET !ERRORIGNORE YES
SET !DATASOURCE "C:/Users/Testing/Desktop/file_name.csv"
SET !DATASOURCE_COLUMNS 1
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !VAR1 EVAL("var randomImage=Math.random() >= 0.5 ? 'C:\1.jpg' : 'C:\2.jpg';randomImage;")
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_0 CONTENT={{!VAR1}}
SET !VAR2 EVAL("var randomImage= Math.random() >= 0.5 ? 'C:\1.jpg' : 'C:\2.jpg';randomImage;")
TAG POS=1 TYPE=INPUT:FILE FORM=ID:formular ATTR=ID:image_1 CONTENT={{!VAR2}}
'this line of content will replace SEL1 until SEL50
TAG POS=1 TYPE=SELECT FORM=ID:formular ATTR=ID:test CONTENT=%{{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:formular ATTR=ID:c_publish
CSV File(Name: file_name.csv):
202
207
212
217
222
227
232
237
242
247
252
257
262
267
272
277
282