Multiple Text Recognition and tag a button

Discussions and Tech Support specific to the iMacros for Chrome extension.
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
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple Text Recognition and tag a button

Post by chivracq » Mon Jul 25, 2016 3:01 pm

derrickrantel wrote:Thanks chivracq
Ive implemented the same code you provided me but somehow still not working.

Ive also tried this and its not working

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
SET !EXTRACT_TEST_POPUP NO

URL GOTO=https://www.testingwebsite.com
TAG POS=1 TYPE=IMG ATTR=SRC:Loadmoreresults.png
WAIT SECONDS=3
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=TXT:*Blue* EXTRACT=TXT
SET Confirm EVAL("var s='{{!EXTRACT}}'; var x; if(s!='#EANF#'){x=1;} else{x=0;}; x;")
TAG POS={{Confirm}} TYPE=IMG ATTR=SRC:SumitInterest.png
TAG POS={{Confirm}} TYPE=IMG ATTR=SRC:Confirm.png CONTENT=EVENT:MOUSEOVER
TAG POS={{Confirm}} TYPE=IMG ATTR=SRC:Hover_Confirm.png
Both ways either yours or mine both codes still executing the Confirm button and hover_confirm buttons

Searched the forum and someone mentioned SET !ERRORIGNORE YES will cause EANF to not work.
i'm not sure what it means but do you think you can help me solve this?
Thanks
Well, dunno, I can't test anything as you didn't provide the URL... :roll:
Use 'PROMPT' to follow your Vars and debug your Script...

Wondering why "SubmitInterest.png" became "SumitInterest.png" in your last Script...?
Searched the forum and someone mentioned SET !ERRORIGNORE YES will cause EANF to not work.
i'm not sure what it means but do you think you can help me solve this?
Oh...!, dunno about that one, provide the Link(s) to the Thread(s) you found on the Forum, I dunno anything about '#EANF#' not working with '!ERRORIGNORE', at least for the last 20 Versions... It's always worked correctly for me since I've been using iMacros... (10 years +)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Multiple Text Recognition and tag a button

Post by iimfun » Mon Jul 25, 2016 3:11 pm

Does the following macro extract correctly the 'Colour' and 'level' values from the table?

Code: Select all

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=TD ATTR=TXT:Colour
TAG POS=R8 TYPE=TD ATTR=* EXTRACT=TXT
TAG POS=R2 TYPE=TD ATTR=* EXTRACT=TXT
SET !EXTRACT EVAL("'{{!EXTRACT}}'.replace(/\\n/g,'');")
PROMPT {{!EXTRACT}}
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Mon Jul 25, 2016 7:48 pm

iimfun wrote:Does the following macro extract correctly the 'Colour' and 'level' values from the table?

Code: Select all

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=TD ATTR=TXT:Colour
TAG POS=R8 TYPE=TD ATTR=* EXTRACT=TXT
TAG POS=R2 TYPE=TD ATTR=* EXTRACT=TXT
SET !EXTRACT EVAL("'{{!EXTRACT}}'.replace(/\\n/g,'');")
PROMPT {{!EXTRACT}}
hi iimfun

Could you kindly explain the code you mentioned?
Thank you very much

hi Chivracq
Sorry for that submitinterest is just a typo when presenting my code to you.
Not affecting the real thing when im running the script
Just wanted to let you know
The buttons are executing even when the colour "blue" was not found
Meaning the eval is spitting out a 1 value for the pos i guess?

When i test the script individually only extracting the text
It seems to work fine. Blue gets extracted and got the popup if it is present
Or else no popup.
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Multiple Text Recognition and tag a button

Post by iimfun » Tue Jul 26, 2016 8:23 am

Derrick, I suppose that this was about my code
When i test the script individually only extracting the text
It seems to work fine. Blue gets extracted and got the popup if it is present
Or else no popup.
So OK! Now it's time for the 'EVAL' command. I tried to code the following logic
My list of keywords will be "Blue" "red" "orange" "podium"
if under the field "Colour" the text "blue" is found, then click on the submit button
If the field "colour" the text is "purple", the script does NOT click on the submit button

Also, under the field "Level" if the text "Podium" appears, then click on the submit button

The below is abit more complicated incase of conditional behaviors but i'm not sure if it is possible. do let me know.
IF, Colour field is "Purple" but level field is "podium" , I still would like it to click on submit button.
by right "purple" is not what i want but then "podium" is what i want, so would i be able to make it still click on the submit button?
It seems to be simple

Code: Select all

SET w11 "blue"
SET w12 "red"
SET w13 "orange"
SET w21 "podium"

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=TD ATTR=TXT:Colour
TAG POS=R8 TYPE=TD ATTR=* EXTRACT=TXT
TAG POS=R2 TYPE=TD ATTR=* EXTRACT=TXT

SET S "var w11 = /{{w11}}/i; var w21 = /{{w21}}/i;"
ADD S "var p = 0; var e = '{{!EXTRACT}}'.split('[EXTRACT]');"
ADD S "if (e[0].match(w11) || (e[1].match(w21))) p = 1;"
ADD S "p;"
SET posSubmit EVAL("eval('{{S}}');")
PROMPT {{posSubmit}}
The macro above shows up a prompt dialog with '1' when it's going to click on the Submit button and shows up an empty dialog otherwise. If this code works, probably the problem has been almost solved.
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Tue Jul 26, 2016 10:02 am

iimfun wrote:Derrick, I suppose that this was about my code
When i test the script individually only extracting the text
It seems to work fine. Blue gets extracted and got the popup if it is present
Or else no popup.
So OK! Now it's time for the 'EVAL' command. I tried to code the following logic
My list of keywords will be "Blue" "red" "orange" "podium"
if under the field "Colour" the text "blue" is found, then click on the submit button
If the field "colour" the text is "purple", the script does NOT click on the submit button

Also, under the field "Level" if the text "Podium" appears, then click on the submit button

The below is abit more complicated incase of conditional behaviors but i'm not sure if it is possible. do let me know.
IF, Colour field is "Purple" but level field is "podium" , I still would like it to click on submit button.
by right "purple" is not what i want but then "podium" is what i want, so would i be able to make it still click on the submit button?
It seems to be simple

Code: Select all

SET w11 "blue"
SET w12 "red"
SET w13 "orange"
SET w21 "podium"

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=TD ATTR=TXT:Colour
TAG POS=R8 TYPE=TD ATTR=* EXTRACT=TXT
TAG POS=R2 TYPE=TD ATTR=* EXTRACT=TXT

SET S "var w11 = /{{w11}}/i; var w21 = /{{w21}}/i;"
ADD S "var p = 0; var e = '{{!EXTRACT}}'.split('[EXTRACT]');"
ADD S "if (e[0].match(w11) || (e[1].match(w21))) p = 1;"
ADD S "p;"
SET posSubmit EVAL("eval('{{S}}');")
PROMPT {{posSubmit}}
The macro above shows up a prompt dialog with '1' when it's going to click on the Submit button and shows up an empty dialog otherwise. If this code works, probably the problem has been almost solved.
Thanks iimfun but dont mind me asking
how do i integreate this above code into my my current code?

Thanks thanks sorry for the noob questions
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Multiple Text Recognition and tag a button

Post by iimfun » Tue Jul 26, 2016 3:07 pm

I took your first version of the macro and tried to integrate two codes here

Code: Select all

SET w11 "blue"
SET w12 "red"
SET w13 "orange"
SET w21 "podium"

TAB T=1
URL GOTO=https://www.exampletesting.com
SET !ENCRYPTION NO
'This section below will login my account on the website automatically'
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:login ATTR=ID:login:password CONTENT=mypassword
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:login ATTR=NAME:login:id1

'here, it clicks a "load results button
TAG POS=1 TYPE=IMG ATTR=SRC:https://loadresultsbutton.png
WAIT SECONDS=0.2

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=TD ATTR=TXT:Colour
TAG POS=R8 TYPE=TD ATTR=* EXTRACT=TXT
TAG POS=R2 TYPE=TD ATTR=* EXTRACT=TXT

SET S "var w11 = /{{w11}}/i; var w21 = /{{w21}}/i;"
ADD S "var p = 0; var e = '{{!EXTRACT}}'.split('[EXTRACT]');"
ADD S "if (e[0].match(w11) || (e[1].match(w21))) p = 1;"
ADD S "p;"
SET posSubmit EVAL("eval('{{S}}');")

SET !ERRORIGNORE YES
'here, it clicks on the "submit interest button' and then 'yes button' and finally a 'confirm button'
TAG POS={{posSubmit}} TYPE=IMG ATTR=SRC:https://submitinterest.png
TAG POS={{posSubmit}} TYPE=IMG ATTR=SRC:https://yes.png CONTENT=EVENT:MOUSEOVER
TAG POS={{posSubmit}} TYPE=IMG ATTR=SRC:https://confirm.png
WAIT SECONDS=0.3
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Wed Jul 27, 2016 9:38 am

iimfun wrote:I took your first version of the macro and tried to integrate two codes here

Code: Select all

SET w11 "blue"
SET w12 "red"
SET w13 "orange"
SET w21 "podium"

TAB T=1
URL GOTO=https://www.exampletesting.com
SET !ENCRYPTION NO
'This section below will login my account on the website automatically'
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:login ATTR=ID:login:password CONTENT=mypassword
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:login ATTR=NAME:login:id1

'here, it clicks a "load results button
TAG POS=1 TYPE=IMG ATTR=SRC:https://loadresultsbutton.png
WAIT SECONDS=0.2

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=TD ATTR=TXT:Colour
TAG POS=R8 TYPE=TD ATTR=* EXTRACT=TXT
TAG POS=R2 TYPE=TD ATTR=* EXTRACT=TXT

SET S "var w11 = /{{w11}}/i; var w21 = /{{w21}}/i;"
ADD S "var p = 0; var e = '{{!EXTRACT}}'.split('[EXTRACT]');"
ADD S "if (e[0].match(w11) || (e[1].match(w21))) p = 1;"
ADD S "p;"
SET posSubmit EVAL("eval('{{S}}');")

SET !ERRORIGNORE YES
'here, it clicks on the "submit interest button' and then 'yes button' and finally a 'confirm button'
TAG POS={{posSubmit}} TYPE=IMG ATTR=SRC:https://submitinterest.png
TAG POS={{posSubmit}} TYPE=IMG ATTR=SRC:https://yes.png CONTENT=EVENT:MOUSEOVER
TAG POS={{posSubmit}} TYPE=IMG ATTR=SRC:https://confirm.png
WAIT SECONDS=0.3
Ok thank you very much!!!! Ill try it out!!!!
Post Reply