Choose from a drop down - capital specific

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
Post Reply
bcrider
Posts: 10
Joined: Wed Feb 10, 2021 3:11 pm

Choose from a drop down - capital specific

Post by bcrider » Wed Feb 10, 2021 3:27 pm

First, I read the forum rules and here is the requested information about my system/build, if I missed something that you would like included in the future please let me know and I will be happy to comply.
VERSION BUILD=12.6.505.4525
Windows 10 Pro - English
Internet Explorer Version 1909 (OS Build 18363.1316)

The issue, I have to update 300+ options in a drop down, the drop down has two different options that may be in either order, they are the same thing with the exception that one is capitalized and one is not, eg abcd.worx vs ABCD.worx and I need to ensure that I am choosing the lowercase version.

I have this line in my code, but it always chooses whichever one is on top and is not specific to capitalization, searching the forum I am unable to find a relevant post on how to require a specific capitalization or not.

TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain CONTENT=$abcd.worx and TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain CONTENT=%abcd.worx both select whichever option is on top.


Thank you and please let me know if you require any other information to help me out here.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Choose from a drop down - capital specific

Post by chivracq » Wed Feb 10, 2021 7:09 pm

bcrider wrote:
Wed Feb 10, 2021 3:27 pm
First, I read the forum rules and here is the requested information about my system/build, if I missed something that you would like included in the future please let me know and I will be happy to comply.

Code: Select all

VERSION BUILD=12.6.505.4525
Windows 10 Pro - English
Internet Explorer Version 1909 (OS Build 18363.1316)
The issue, I have to update 300+ options in a drop down, the drop down has two different options that may be in either order, they are the same thing with the exception that one is capitalized and one is not, eg abcd.worx vs ABCD.worx and I need to ensure that I am choosing the lowercase version.

I have this line in my code, but it always chooses whichever one is on top and is not specific to capitalization, searching the forum I am unable to find a relevant post on how to require a specific capitalization or not.

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain CONTENT=$abcd.worx
and

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain CONTENT=%abcd.worx
both select whichever option is on top.


Thank you and please let me know if you require any other information to help me out here.

Yep, good-good, Quality of your OP is perfect... :D

And hum..., this is actually "the interesting" Thread/Qt of the Week, so far, ah-ah...! :twisted: 8)

And..., yep indeed, I knew the 'TXT' Attribute from the 'ATTR' Param was Case insensitive for the 'TAG' Mode/Command, which is in "most Cases" quite practical, well at least for me in one of my Scripts, I had never (needed to) check(ed) if that also applied to the 'CONTENT' Param for 'DDLB' Elements, but it looks like you've found out that it is also, ah-ah...!, and you've already tried to select both by 'Name' + by 'Value', to no avail... :|
OK, good-good... (You did the "correct" Troubleshooting, and tried the "correct" Things...) :D

>

Then OK, I can think of several Ways to still implement the Func that you want :shock: 8) , I guess (one of) the easiest Way(s) will be to first extract all Entries from the 'DDLB' (with 'EXTRACT=TXTALL') to "find out" in which Order they are listed, to then dynamically compute a "1"/"2" to reuse with the '#' Selector (=> Select by 'Index'), or adjust to a "2"/"3" Index Value if your DDLB contains some "Select Domain..." Default Entry at the Top of the DDLB...

Many Ways to implement it..., you'll need 'EVAL()' of course, and I can "tell you" that 'split()' for example IS Case Sensitive, but maybe 'indexOf()' also, I'm not sure you/I would need to test...

I let you "sweat" a little bit to "see" if you manage to implement that Func yourself, well.... you didn't post any URL, so I can't really write the Script "directly" for you anyway..., and "shout" if you get stuck "somewhere"..., or post your Solution if you succeed by yourself...! :wink:

You can also have a Look at the following Thread where I had already posted a Sol that would be very similar to the Func that you want, and where I'm pretty sure I was also/already using 'split()' nearly in the Way that you want/need...: :idea:
- Re: Number of Options in a Select tag

>

If you don't manage by yourself, I would need that you either post the URL of that Page if it's not behind L&P of course, or upload it to your Thread, so that I can test myself..., or at least that you post the Content of the 'EXTRACT=TXTALL' and/or the Content of 'EXTRACT=HTM' on the whole 'DDLB'... :idea:
(Hum, and maybe x2, for both "Situations"...)
- (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...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Choose from a drop down - capital specific

Post by chivracq » Sun Feb 14, 2021 12:39 am

Hum..., and...?, still no Follow-up/Progress, 4 days later...!? :?: :o :(

(I don't try to help Users again if they don't follow up on their Threads, and post their final/working Script, just saying... :idea: )
- (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...
bcrider
Posts: 10
Joined: Wed Feb 10, 2021 3:11 pm

Re: Choose from a drop down - capital specific

Post by bcrider » Wed Feb 17, 2021 6:39 pm

Unfortunately I was not able to figure this one out even looking over your older post. When I attempted to do the export it didn't seem to work correctly and export the options, but looking at the HTML code it is strictly the two options mentioned as posted below.

Code: Select all

<TD align="left" colspan="3"><input type='text' name='newUserId' maxlength='80'> @ <SELECT NAME='newDomain'>
<OPTION VALUE='ABCD.worx'>ABCD.worx
<OPTION VALUE='abcd.worx' SELECTED >abcd.worx
</SELECT></TD>
Unfortunately this one has me stumped and I am unable to provide access to the actual site as it is a password protected site. If you can be of further assistance with what I have provided it would be greatly appreciated, if not I understand.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Choose from a drop down - capital specific

Post by chivracq » Thu Feb 18, 2021 9:54 pm

bcrider wrote:
Wed Feb 17, 2021 6:39 pm
Unfortunately I was not able to figure this one out even looking over your older post. When I attempted to do the export it didn't seem to work correctly and export the options, but looking at the HTML code it is strictly the two options mentioned as posted below.

Code: Select all

<TD align="left" colspan="3"><input type='text' name='newUserId' maxlength='80'> @ <SELECT NAME='newDomain'>
<OPTION VALUE='ABCD.worx'>ABCD.worx
<OPTION VALUE='abcd.worx' SELECTED >abcd.worx
</SELECT></TD>
Unfortunately this one has me stumped and I am unable to provide access to the actual site as it is a password protected site. If you can be of further assistance with what I have provided it would be greatly appreciated, if not I understand.

Oh good...!, you are still "alive", ah-ah...! :D

Yeah well, from the following 'EXTRACT' on your DDLB:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain EXTRACT=TXTALL
... => don't you get stg like the following in the 'EXTRACT'...?:

Code: Select all

ABCD.worx[OPTION]abcd.worx
- (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...
bcrider
Posts: 10
Joined: Wed Feb 10, 2021 3:11 pm

Re: Choose from a drop down - capital specific

Post by bcrider » Fri Feb 19, 2021 4:46 pm

ok, that time I got exactly what you typed there. I was trying to use the extract option in the record macro and it was only giving me one of the domains and not the other.

OK, so I have this now and it is successfully selecting the 2nd option each time, but I'm not sure how to adjust this so it looks at the case specific and gives me the lowercase version.

Code: Select all


VERSION BUILD=12.6.505.4525
'SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain EXTRACT=TXTALL

SET DDLB_Nb_of_Options EVAL("var s='{{!EXTRACT}}'; var x,y; y=s.split('[OPTION]'); x=y.length; x;")
PROMPT DDLB_Nb_of_Options:<SP>_{{DDLB_Nb_of_Options}}_

'Select Last Option in DDLB:
TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain CONTENT=#{{DDLB_Nb_of_Options}}

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

Re: Choose from a drop down - capital specific

Post by chivracq » Sat Feb 20, 2021 7:14 am

bcrider wrote:
Fri Feb 19, 2021 4:46 pm
ok, that time I got exactly what you typed there. I was trying to use the extract option in the record macro and it was only giving me one of the domains and not the other.

OK, so I have this now and it is successfully selecting the 2nd option each time, but I'm not sure how to adjust this so it looks at the case specific and gives me the lowercase version.

Code: Select all

VERSION BUILD=12.6.505.4525
'SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain EXTRACT=TXTALL

SET DDLB_Nb_of_Options EVAL("var s='{{!EXTRACT}}'; var x,y; y=s.split('[OPTION]'); x=y.length; x;")
PROMPT DDLB_Nb_of_Options:<SP>_{{DDLB_Nb_of_Options}}_

'Select Last Option in DDLB:
TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain CONTENT=#{{DDLB_Nb_of_Options}}

OK, good...!

Well about "I was trying to use the extract option in the record macro and it was only giving me one of the domains and not the other.", that's because you were using (well..., or the Wizard!) 'EXTRACT=TXT' and not 'EXTRACT=TXTALL' like I had mentioned, then you will get the Option currently selected in the DDLB...

Then OK, from the Script you posted/reused to always select the last/2nd Option in the DDLB, it is fairly easy to adapt to force it to select the Lowercase "abcd.worx" Option by using the Fact that I mentioned that 'split()' is Case Sensitive, with stg like for example:

Code: Select all

VERSION BUILD=12.6.505.4525
'SET !EXTRACT_TEST_POPUP NO

TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain EXTRACT=TXTALL
'=> Extracted: "ABCD.worx[OPTION]abcd.worx" or "abcd.worx[OPTION]ABCD.worx".

'Debug:
'SET !EXTRACT "ABCD.worx[OPTION]abcd.worx"
'SET !EXTRACT "abcd.worx[OPTION]ABCD.worx"

'Not needed:
'SET DDLB_Nb_of_Options EVAL("var s='{{!EXTRACT}}'; var x,y; y=s.split('[OPTION]'); x=y.length; x;")
'PROMPT DDLB_Nb_of_Options:<SP>_{{DDLB_Nb_of_Options}}_

SET abcd_Index EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('[OPTION]'); y=x[0].split('abcd'); if(y.length>1){z=1;} else{z=2;};  z;")
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR><BR>abcd_Index:<SP>_{{abcd_Index}}_

PAUSE
'Select 'abcd.worx' Option (Lowercase) in DDLB (by Index):
TAG POS=1 TYPE=SELECT ATTR=NAME:newDomain CONTENT=#{{abcd_Index}}
(Tested in iMacros for FF v8.8.2, PM v26.3.3, Win10_x64.)

I toggled one of the 2 "SET !EXTRACT xxx" to be able to test myself both Cases...
- (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...
bcrider
Posts: 10
Joined: Wed Feb 10, 2021 3:11 pm

Re: Choose from a drop down - capital specific

Post by bcrider » Thu Mar 11, 2021 3:26 pm

Thank you very much! I just had the first opportunity to use this last night (have to schedule it with customer and IT personnel) and it worked perfectly!

One question I have though is in the below code portion there is a "split('abcd'), this is specifically looking for those letters in that specific case, correct? So if I needed to re-use this for defg I would update that portion to be what I want it to look for?

Code: Select all

SET abcd_Index EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('[OPTION]'); y=x[0].split('abcd'); if(y.length>1){z=1;} else{z=2;};  z;")
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Choose from a drop down - capital specific

Post by chivracq » Thu Apr 22, 2021 1:10 am

bcrider wrote:
Thu Mar 11, 2021 3:26 pm
Thank you very much! I just had the first opportunity to use this last night (have to schedule it with customer and IT personnel) and it worked perfectly!

One question I have though is in the below code portion there is a "split('abcd'), this is specifically looking for those letters in that specific case, correct? So if I needed to re-use this for defg I would update that portion to be what I want it to look for?

Code: Select all

SET abcd_Index EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('[OPTION]'); y=x[0].split('abcd'); if(y.length>1){z=1;} else{z=2;};  z;")

Oh...!, I never replied, but yep-yep of course, you are correct... :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...
Post Reply