Code: Select all
iMacros 2021 Enterprise x64 bits
PC Windows 8.1 Portuguese/BR
Hello, forum! This is my first post, I apologize if I make a mistake about any rule that I didn't understand and I ask that you consider please to being patient with a new lay user who started using this imacros language a few days ago.
The scenario of the logic problem to automate the Html restaurant delivery game: It will be a page of a puzzle that I will develop for simulations of a game with random results that needs to match the "order" with the "food" to regarding one of the 3 choices.
First: i will need to choose one of three choices(the customer).
Second: a word with food's name will appear and then i need to choose the correct image with the picture of this word.
Third: Validate on the last button.
In this puzzle, will have a total of 11 images (Radio buttons) are shuffled and a word from one of these 11 images appears, each one with an ID. I need to click on the correct image (Radio button) that refers the word, to validate the correspondent demand, each right confirmation gives xp.
I don't have the url of my game available yet, it's just a matter of conditional logic to learning for those starting out.
Question: Select the desired alternative and then select the image of the random word.
Example:
"Select the image (some of the 11 assorted images in few amount) that matches the word "soup" and then "Confirm", then appears images like "soda, cake, soup, cookie".
The correct on is in Position 3 (horizontally), but it could be in any position, so i need to find, validate and use this text "soup" as an anchor/key to create the condition to execute the specific click on the correct image for automatic select the position and the radio:input by the specific id number of the image based on text "soup", ignoring others radiobuttons macros and focusing only on the word that appears and the image, ignoring other possibilities.
Limitations/difficulties:
I don't believe that !VAR can solve it, because I will need to work with many amounts of images, more than 10.
The positions of the images will alternate and I don't know how to indicate in POS=?.
Again, sorry for my ignorance, I imagine i'm completely lost and I don't know where to go. I swear there are days I tried to understand some logic it on my own both on the wiki and on the forum, but nothing was clear enough for my limitation.
HTML Layout Example:
I'm trying to deduce how to develop the following code with what i've found, but insecure about create click conditions on one of 11 random images based on a single random word out of 11 too:
Code: Select all
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
'Select customer (ok here)'
TAG POS=1 TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:100
'list to match the unique word that appear with one of the correct image'
'if find the word soda, then find the position of the image of the soda recognized by html id, "idword1", and ignore the others macros.'
SET Forward_To "soda"
TAG POS=1 TYPE=B ATTR=soda
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=RADIO:INPUT FORM=ID:demo-form ATTR=ID:word1
'if find the word barbecue, then find the position of the image of the barbecue recognized by html id, id "word2", and ignore the others macros.'
SET Forward_To "barbecue"
TAG POS=1 TYPE=B ATTR=TXT:barbecue
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word2
'if find the word pie, then find the position of the image of the pie recognized by html id, id "word3", and ignore the others macros.'
SET Forward_To "pie"
TAG POS=1 TYPE=B ATTR=TXT:pie
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word3
'if find the word noodle, then find the position of the image of the noodle recognized by html id, id "word4", and ignore the others macros.'
SET Forward_To "noodle"
TAG POS=1 TYPE=B ATTR=TXT:noodle
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word4
'if find the word soup, then find the position of the image of the soup recognized by html id, id "word5", and ignore the others macros.'
SET Forward_To "soup"
TAG POS=1 TYPE=B ATTR=TXT:soup
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word5
'if find the word bread, then find the position of the image of the bread recognized by html id, id "word6", and ignore the others macros.'
SET Forward_To "bread"
TAG POS=1 TYPE=B ATTR=TXT:bread
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word6
'if find the word hotdog, then find the position of the image of the hotdog recognized by html id, id "word7", and ignore the others macros.'
SET Forward_To "hotdog"
TAG POS=1 TYPE=B ATTR=TXT:hotdog
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word7
'if find the word sandwich, then find the position of the image of the sandwich recognized by html id, id "word8", and ignore the others macros.'
SET Forward_To "sandwich"
TAG TYPE=B ATTR=TXT:sandwich
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS= ? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word8
'if find the word icecream, then find the position of the image of the icecream recognized by html id, id "word9", and ignore the others macros.'
SET Forward_To "icecream"
TAG POS=1 TYPE=B ATTR=TXT:icecream
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word9
'if find the word cake, then find the position of the image of the cake recognized by html id, id "word10", and ignore the others macros.'
SET Forward_To "cake"
TAG POS=1 TYPE=B ATTR=TXT:cake
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word10
''if find the word cookie, then find the position of the image of the cookie recognized by html id, id "word11", and ignore the others macros.'
SET Forward_To "cookie"
TAG POS=1 TYPE=B ATTR=TXT:cookie
TAG POS=1 TYPE=B ATTR=TXT:*{{Forward_To}}*
TAG POS=? TYPE=INPUT:RADIO FORM=ID:demo-form ATTR=ID:word11
'ok here too, the final confirmation'
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:demo-form ATTR=ID:submit