Setting up an iMacro to recognize multiple text and click the link in that line

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
yehuda
Posts: 14
Joined: Wed Oct 21, 2020 11:57 pm

Setting up an iMacro to recognize multiple text and click the link in that line

Post by yehuda » Thu Dec 24, 2020 6:37 am

Good evening,

VERSION BUILD=12.6.505.4525
IE11
WIndows 7

I am looking to set up an iMacro where it will search for certain criteria in a table on a specific webpage and then click a link on that line.

I have a CSV file with a few columns and I would like the iMacro to only click on the line if all criteria match. So it should find the line with all the correct fields. I do not want it to go to the next loop until it find a match and completes the rest of my task. One of the lines in the table will for sure match.

Once the link is clicked it will open another "small" tab where I will make my changes and click save. Once save is pressed there is a popup with a message that it was successful. I would like to extract the message and enter it on that row in the CSV file.

I am willing to figure it out what I really need is a sample file or some guidance on where to start so I can build off this.
yehuda
Posts: 14
Joined: Wed Oct 21, 2020 11:57 pm

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by yehuda » Thu Dec 24, 2020 6:47 pm

I may not have shown that I have done enough work on my end. So let me try to do this step by step.

I know how to use the relative position function however I am looking for a way to choose a row based on meeting a few criteria.

I have attached an example. In this case, I want it to find the line that has 0210 in column A and 07/04/2020 in Column C.
Attachments
Capture.PNG
Capture.PNG (6.08 KiB) Viewed 7093 times
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by chivracq » Thu Dec 24, 2020 7:01 pm

yehuda wrote:
Thu Dec 24, 2020 6:37 am
Good evening,

Code: Select all

VERSION BUILD=12.6.505.4525
IE11
WIndows 7
I am looking to set up an iMacro where it will search for certain criteria in a table on a specific webpage and then click a link on that line.

I have a CSV file with a few columns and I would like the iMacro to only click on the line if all criteria match. So it should find the line with all the correct fields. I do not want it to go to the next loop until it find a match and completes the rest of my task. One of the lines in the table will for sure match.

Once the link is clicked it will open another "small" tab where I will make my changes and click save. Once save is pressed there is a popup with a message that it was successful. I would like to extract the message and enter it on that row in the CSV file.

I am willing to figure it out what I really need is a sample file or some guidance on where to start so I can build off this.

Yep-yep, sounds completely "Legit" (and "Interesting" also) Scenario, completely possible to implement with iMacros, shouldn't be very-very difficult...

But, hum-tja-tja...!, would need more (Info) to be able to help you "concretely", I'm afraid... I would say, => start implementing the Func that you want, and "shout" if/when you get stuck "somewhere"...

=> All based on 'EXTRACT' / '!COLn' / 'EVAL()' / 'R-POS', I "reckon"... :idea:

EDIT:
Oh...!, and you've just posted a new Post while I was typing, ah-ah...!
Got a Friend over, cooking for Xmas Eve, a few other Friends also coming over, I'll check your Post a bit later... :wink:
- (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...
yehuda
Posts: 14
Joined: Wed Oct 21, 2020 11:57 pm

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by yehuda » Thu Dec 24, 2020 7:25 pm

I can smell the cooking here...:)

I am not sure if you are kidding in regards to "legit" but we have to update pay rates as of 12/31/2019 to remain compliant with the new wage increase.

I am up to the part of the script where it it is looking for the row that matches my multiple criteria and seems EVAL is the way to go. My bigger problem is I don't know Javascript.
yehuda
Posts: 14
Joined: Wed Oct 21, 2020 11:57 pm

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by yehuda » Sun Dec 27, 2020 2:06 am

I am allowed to bump this here?
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by chivracq » Sun Dec 27, 2020 3:09 am

yehuda wrote:
Sun Dec 27, 2020 2:06 am
I am allowed to bump this here?
yehuda wrote:
Thu Dec 24, 2020 7:25 pm
I can smell the cooking here...:)

I am not sure if you are kidding in regards to "legit" but we have to update pay rates as of 12/31/2019 to remain compliant with the new wage increase.

I am up to the part of the script where it it is looking for the row that matches my multiple criteria and seems EVAL is the way to go. My bigger problem is I don't know Javascript.
Euh, yep-yep, but you need to post your "Business Rules" for me to understand what you want...

>>>

(I don't have any Internet, or very difficult, since 3 weeks, I never know when I'll be able to reply...)
- (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...
yehuda
Posts: 14
Joined: Wed Oct 21, 2020 11:57 pm

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by yehuda » Sun Dec 27, 2020 3:26 am

On our website, we can have multiple rates for an employee depending on a number of different factors. At the of the row, there is a link to edit the rate.

I already build the part of the iMacro to go to individual employees' profile and to the rate section and now you come across something like this on the website.
Image1.PNG
Now in my CSV file, I have this information lined up along with the other variables (to be able to get to the employee's profile) and I am looking to click on the edit button on the row that matches exactly. In the above example the first 3 rows the job name, job type, and rate code match nut I am specifically looking for the 3rd row as my CSV file will have all the headers.

Is there a way to set up the iMacro to identify the line that has all the criteria as true and then know what row it is and click the edit button?
yehuda
Posts: 14
Joined: Wed Oct 21, 2020 11:57 pm

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by yehuda » Tue Dec 29, 2020 4:50 pm

Going to bump this to see if I can get a reply before new years.

Thanks!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by chivracq » Tue Dec 29, 2020 11:01 pm

yehuda wrote:
Sun Dec 27, 2020 2:06 am
I am allowed to bump this here?
yehuda wrote:
Tue Dec 29, 2020 4:50 pm
Going to bump this to see if I can get a reply before new years.

Thanks!

Yep-yep, no Pb to bump, even if it won't "really" help, I "see" all Posts anyway and I'm also the most active Helper on the Forum, but (my) Pb is that I don't have any Internet since 3 nearly 4 weeks, only when some Friend comes and visit me and can tether for me for a few hours or I go to some Neighbour a bit further up in my street (where I'm now, but too far to catch his WiFi Signal from my place) but then I can only quickly approve New Posts/Threads and run a few of my own Scripts, but I cannot really do some "Chatting" with sbd else or some "thorough Thinking" for the Forum, and your Thread requires quite some "Thinking", ah-ah...!
But my Neighbour is now "busy" on some 'Discord' Server, so this is your Chance, ah-ah...! :wink:

>>>

Then yep, I have a Technique for your Scenario, but hum, it's a bit "High Level", ah-ah...! :twisted:
I can only give you the "big lines", I can't do any Testing/Checking for you...

You would need to save a "Version" of your '.csv' DataSource as an '.html' 'Save as' from 'Excel', and to open in your Browser in a 'TAB-2'.
Even if hum, I don't recognize any (similar) Content from your 2 Screenshots, so I don't really see the Relationship between both, but if you want to locate the Row containing "0210' + "07/04/2020", this is a bit what you need to do...:

Code: Select all

TAB T=1
URL GOTO= // Your Online Website...

'Load '.csv' DataSource as a Local '.html' File in 'TAB_2':
'TAB OPEN
TAB T=2
URL GOTO=file:///c:/TEMP/Your_DataSouce.html

SET !EXTRACT NULL
TAG POS=1 TYPE=TABLE ATTR=* EXTRACT=HTM
SET Full_HTML_Table {{!EXTRACT}}

SET Crit_1 "0210"
SET Crit_2 "07/04/2020"

SET !EXTRACT NULL
TAG POS=1 TYPE=TR ATTR=TXT:*{{Crit_1}}*{{Crit_2}}* EXTRACT=HTM
SET HTML_Row {{!EXTRACT}}

'Compute corresponding Row:
SET CSV_Row_Nb EVAL("var fht='{{Full_HTML_Table}}', hr='{{HTML_Row}}'; var x,y,z; x=fht.split(hr)[0]; y=x.split('<TR'); z=(y.length)+1; z;")
PROMPT CSV_Row_Nb:<SP>_{{CSV_Row_Nb}}_
Written from scratch while talking with my Friends, not tested at all, there are probably a few Typos... :oops:
The "+1" is meant if you have a Header in the '.csv', maybe it's not needed or you might need to tune it, use the 'PROMPT' to follow and debug the Vars, you can change the final "z;" in the 'EVAL()' to "x;" and "y;" to debug the 'EVAL()' if it doesn't work directly... :idea:

Then I'm not sure what is the direct Relationship with the 2nd Screenshot but the same Technique can be used to locate the correct 'Edit' Link, either using 'R-POS' or 'POS=n'... :idea:

OK, I hope you understand the Technique, it is a little bit "Advanced", like I mentioned, ah-ah...! :twisted:
- (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...
yehuda
Posts: 14
Joined: Wed Oct 21, 2020 11:57 pm

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by yehuda » Tue Dec 29, 2020 11:15 pm

Thanks!

This looks pretty advanced and at first glance seems over my head.

The first screenshot is an actual screenshot but due to potential HIPPA, I had to cross out some of it. The second one was the basic idea I just put together in excel.

Going to try what you posted and see if I can make head or tails out of it and report back.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by chivracq » Tue Dec 29, 2020 11:29 pm

yehuda wrote:
Tue Dec 29, 2020 11:15 pm
Thanks!

This looks pretty advanced and at first glance seems over my head.

The first screenshot is an actual screenshot but due to potential HIPPA, I had to cross out some of it. The second one was the basic idea I just put together in excel.

Going to try what you posted and see if I can make head or tails out of it and report back.

OK, "good Luck" and dare to shout, and hum, good News, I should have a bit of Internet Access now, I just managed to get/buy some Mobile Data Package for 5Gb for 30 Days and I'll be able to tether a bit for myself and to check the Forum a bit more frequently... 8)
- (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...
yehuda
Posts: 14
Joined: Wed Oct 21, 2020 11:57 pm

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by yehuda » Tue Dec 29, 2020 11:39 pm

I am going through your post and i want to make sure you understand this correctly.

I have a CSV file that identieifes the employee number and i have the script that pulls that employee ID number and loads up the page where the employee's rates sit. The next step is to take to multiple columns from the same row of this CSV file and match it against the rows that are on the website and once it finds the correct row that matches all the criteria it will click edit and change some information based on the further columns in the this CSV file. almost none of this information is static and it is all in the CSV file.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by chivracq » Wed Dec 30, 2020 12:24 am

yehuda wrote:
Tue Dec 29, 2020 11:39 pm
I am going through your post and i want to make sure you understand this correctly.

I have a CSV file that identieifes the employee number and i have the script that pulls that employee ID number and loads up the page where the employee's rates sit. The next step is to take to multiple columns from the same row of this CSV file and match it against the rows that are on the website and once it finds the correct row that matches all the criteria it will click edit and change some information based on the further columns in the this CSV file. almost none of this information is static and it is all in the CSV file.

Still a bit difficult to understand what is your Input and what is the expected Output to understand the whole Workflow of your Process...

The Script I posted is to identify a Row in your '.csv' DataSource (as Output) (and based on 'Crit_1' + 'Crit_2' as Input (and in this Order!)), but if you need to locate a Row on the Site, then you'll need to use the same Technique like I "demonstrated" on the 'TABLE' Element on the Webpage itself and not on your '.csv' like I thought you needed...

And maybe even easier, if you "simply" want to locate (and click) the "correct" 'Edit' Link, then stg like the following, using Double 'R-POS' might be easier... (based on the previous Script, I don't repeat everything):

Code: Select all

SET Crit_1 "0210"
SET Crit_2 "07/04/2020"

TAG POS=1 TYPE=TR ATTR=TXT:*{{Crit_1}}*{{Crit_2}}*
TAG POS=R-1 TYPE=* ATTR=*
TAG POS=R1 TYPE=A ATTR=TXT:Edit
- (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...
yehuda
Posts: 14
Joined: Wed Oct 21, 2020 11:57 pm

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by yehuda » Wed Dec 30, 2020 1:49 am

I am trying to "simply" want to locate (and click) the "correct" 'Edit' Link" If my fields are not "hardcoded" why can't i just pull the reference from the {{!Col1}} etc. Why do I need to set the criteria?

I know you said you don't repeat everything but if I try either of the following I get an error.

tag pos=1 type=tr attr=txt :*{{!col1}}*{{!col2}}*{{!col3}}*{{!col4}}*{{!col5}}*{{!col6}}*{{!col7}}*{{!col8}}
TAG POS=R-1 TYPE=* ATTR=*
TAG POS=R1 TYPE=A ATTR=TXT:Edit

Error -1100: Wrong format of TAG pos=1 type=tr attr=txt :*{{!col1}}*{{!col2}}*{{!col3}}*{{!col4}}*{{!col5}}*{{!col6}}*{{!col7}}*{{!col8}}

set crit_1 {{!col1}}
set crit_2 {{!col2}}
set crit_3 {{!col3}}
set crit_4 {{!col4}}
set crit_5 {{!col5}}
set crit_6 {{!col6}}
set crit_7 {{!col7}}
set crit_8 {{!col8}}

tag pos=1 type=Tr attr=txt :*{{CRIT_1}}*{{CRIT_2}}*{{CRIT_3}}*{{CRIT_4}}*{{CRIT_5}}*{{CRIT_6}}*{{CRIT_7}}*{{CRIT_8}}
TAG POS=R-1 TYPE=* ATTR=*
TAG POS=R1 TYPE=A ATTR=TXT:Edit

Error -1100: Wrong format of TAG pos=1 type=TD attr=txt :*{{CRIT_1}}*{{CRIT_2}}*{{CRIT_3}}*{{CRIT_4}}*{{CRIT_5}}*{{CRIT_6}}*{{CRIT_7}}*{{CRIT_8}}
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Setting up an iMacro to recognize multiple text and click the link in that line

Post by chivracq » Wed Dec 30, 2020 1:58 am

yehuda wrote:
Wed Dec 30, 2020 1:49 am
I am trying to "simply" want to locate (and click) the "correct" 'Edit' Link" If my fields are not "hardcoded" why can't i just pull the reference from the {{!Col1}} etc. Why do I need to set the criteria?

I know you said you don't repeat everything but if I try either of the following I get an error.

Code: Select all

tag pos=1 type=tr attr=txt :*{{!col1}}*{{!col2}}*{{!col3}}*{{!col4}}*{{!col5}}*{{!col6}}*{{!col7}}*{{!col8}}
TAG POS=R-1 TYPE=* ATTR=*
TAG POS=R1 TYPE=A ATTR=TXT:Edit
Error -1100: Wrong format of TAG pos=1 type=tr attr=txt :*{{!col1}}*{{!col2}}*{{!col3}}*{{!col4}}*{{!col5}}*{{!col6}}*{{!col7}}*{{!col8}}

Code: Select all

set crit_1 {{!col1}}
set crit_2 {{!col2}}
set crit_3 {{!col3}}
set crit_4 {{!col4}}
set crit_5 {{!col5}}
set crit_6 {{!col6}}
set crit_7 {{!col7}}
set crit_8 {{!col8}}

tag pos=1 type=Tr attr=txt :*{{CRIT_1}}*{{CRIT_2}}*{{CRIT_3}}*{{CRIT_4}}*{{CRIT_5}}*{{CRIT_6}}*{{CRIT_7}}*{{CRIT_8}}
TAG POS=R-1 TYPE=* ATTR=*
TAG POS=R1 TYPE=A ATTR=TXT:Edit
Error -1100: Wrong format of TAG pos=1 type=TD attr=txt :*{{CRIT_1}}*{{CRIT_2}}*{{CRIT_3}}*{{CRIT_4}}*{{CRIT_5}}*{{CRIT_6}}*{{CRIT_7}}*{{CRIT_8}}

Yep, you in both Scripts have an extra Space in "attr=txt :*{{", => should be "attr=txt:*{{"... :P

And hum, all iMacros Commands and Params are "indeed" Case Insensitive, but "better" Practice (for Readability) is to keep Uppercase for iMacros Commands/Params and Built-in Vars, and use Lowercase (+ Capitals) for your User-defined Vars like I do... :idea:
=> "ATTR=TXT:*{{"...

Extra Spaces are often "tolerantly" accepted, (and that requires a lot of Coding, and for a lot of places where Users might add one or more of extra Spaces), but not for Params I think, was probably too much Coding, I reckon... => "ATTR=TXT :" is (very) probably not correct, should be "ATTR:TXT:"...
- (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...
Post Reply