difficulty executing a selection in a drop down menu

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
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
Jaffey
Posts: 30
Joined: Tue Jul 13, 2010 11:59 am
Location: Toronto, Canada

difficulty executing a selection in a drop down menu

Post by Jaffey » Fri May 10, 2019 11:39 pm

Greetings, I am having difficulty executing a selection in a drop down menu.

When I record the action, it looks like this:

TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT=%5796899

When I try to automate it with this:

TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT={{Plaintiff}}

and some excel VBA feeding it the CONTENT= number using this:

iret = iim1.iimSet("Plaintiff", Cells(row, 19).value)

and the value in Cells(row, 19).value is %5796899 formatted as text.

What I observe is that it selects the drop drown control (puts a blue box around it so I can see it’s selected)But the drop-down doesn’t drop. The code just moves on. No errors etc.

I have tried it with, and without the % sign in the cell, as well as variations like
CONTENT=%{{Plaintiff}}
CONTENT=%+{{Plaintiff}}


Working hard on a Friday night so any assistance muchos gracias.
Cheers!



Microsoft Windows Server 2008 R2 Standard
Microsoft Windows NT 6.1.7601 Service Pack 1
64-bit Operating System
CLR version 4.0.30319.42000
Internet Explorer version 11.0.9600.19326
iMacros Browser (x86) version 12.5.503.8802
Google Chrome version 74.0.3729.131
Mozilla Firefox version 66.0.5 (x86 en-US)
Mozilla Firefox version 66.0.5 (x86 en-US)
iMacros File Access is not installed
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: difficulty executing a selection in a drop down menu

Post by chivracq » Sat May 11, 2019 3:19 pm

Jaffey wrote:
Fri May 10, 2019 11:39 pm
Greetings, I am having difficulty executing a selection in a drop down menu.

When I record the action, it looks like this:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT=%5796899
When I try to automate it with this:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT={{Plaintiff}}
and some excel VBA feeding it the CONTENT= number using this:

Code: Select all

iret = iim1.iimSet("Plaintiff", Cells(row, 19).value)
and the value in Cells(row, 19).value is %5796899 formatted as text.

What I observe is that it selects the drop drown control (puts a blue box around it so I can see it’s selected)But the drop-down doesn’t drop. The code just moves on. No errors etc.

I have tried it with, and without the % sign in the cell, as well as variations like

Code: Select all

CONTENT=%{{Plaintiff}}
CONTENT=%+{{Plaintiff}}
Working hard on a Friday night so any assistance muchos gracias.
Cheers!

Code: Select all

Microsoft Windows Server 2008 R2 Standard 
Microsoft Windows NT 6.1.7601 Service Pack 1
64-bit Operating System
CLR version 4.0.30319.42000
Internet Explorer version 11.0.9600.19326
iMacros Browser (x86) version 12.5.503.8802
Google Chrome version 74.0.3729.131
Mozilla Firefox version 66.0.5 (x86 en-US)
Mozilla Firefox version 66.0.5 (x86 en-US)
iMacros File Access is not installed
Ouf...!, your FCI is nearly "too extended"..., in which Browser(s) then do you run your Script...?

This one won't be correct:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT={{Plaintiff}}
... but this one would be:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT=%{{Plaintiff}}
... as the Select (by Value) '%' Symbol needs to be outside the Var.

Then, pffff-pfff-pfff..., many "Things" could be playing a Role, ah-ah...!
But, OK, "Things" you need to do/try/test, and in the "correct" Order, to "debug" your Case...! :wink:

1- You fist need to check that your Script already works in pure '.iim':
Check that the recorded Action works directly:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT=%5796899
2- Then hard-code your Value:

Code: Select all

SET Plaintiff 5796899
TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT=%{{Plaintiff}}
3- If '1-' or '2-' already have some "Difficulties", especially if the DDLB gets dynamically populated from some previous Statement/Selection, try adding some mini-'WAIT' Statement before the Selection in the 'cboPlaintiffs' DDLB to allow for "enough" time for that DDLB to get populated.

4- A bit like '3-', try using the 'EVENT' Mode which is a bit "slower" than the 'TAG' Mode and often works more reliably with DDLB's.

5- '.vba' Script not posted, so I can't see if you are calling some separate/existing '.iim' Macro or if you are generating an on-the-fly Macro from your '.vba' Script, but for the later, it could be that the '%' Char is maybe a "Special" Char for iMacros or for '.vba' and needs to be escaped with stg like "CONTENT=\%{{Paintiff}}", I would think...

6- From your '.vba' Script, check the exact Content of your 'Cells(row, 19).value' with an 'alert()' (or the '.vba' Equivalent) with some '_' Delimiter around the Var to make sure it doesn't contain any Space or soft-Return or soft-Tab, and that you really get "_5796899_" as a Result (without the Double Quotes).

7- Like '6-', same Procedure, but with a 'PROMPT' in the '.iim':

Code: Select all

PROMPT Plaintiff:<SP>_{{Plaintiff}}_
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Tom, Tech Support
Posts: 3526
Joined: Mon May 31, 2010 4:59 pm

Re: difficulty executing a selection in a drop down menu

Post by Tom, Tech Support » Mon May 13, 2019 12:46 pm

Just one minor correction to the following:
chivracq wrote:
Sat May 11, 2019 3:19 pm
This one won't be correct:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT={{Plaintiff}}
... but this one would be:

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=NAME:cboPlaintiffs CONTENT=%{{Plaintiff}}
... as the Select (by Value) '%' Symbol needs to be outside the Var.
The selection modifier can indeed be a part of the variable value. The following works correctly when hard-coding the variable as well as setting it via the scripting interface:

Code: Select all

URL GOTO=http://demo.imacros.net/Automate/TestForm1
SET food "%Bread and Butter"
TAG POS=1 TYPE=SELECT ATTR=NAME:food CONTENT={{food}}
SET food "$Bread & Butter"
TAG POS=1 TYPE=SELECT ATTR=NAME:food CONTENT={{food}}
The problem could be a timing issue as chivracq suggested, or otherwise the TAG command alone is not triggering the field (likely due to some javascript attached to this element), in which case you can try using EVENT or possibly DirectScreen to select the value.
Regards,

Tom, iMacros Support
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: difficulty executing a selection in a drop down menu

Post by chivracq » Tue May 14, 2019 11:50 pm

Tom, Tech Support wrote:
Mon May 13, 2019 12:46 pm
The selection modifier can indeed be a part of the variable value. The following works correctly when hard-coding the variable as well as setting it via the scripting interface:
Hum, not if the Macro runs in FF or CR, according to the Wiki... :?
@OP didn't mention in which Browser(s) they run their Macro, then leaving the DDLB Selector outside the Var would sound "safer" to me, I would think..., as it would then work (the same) in all 4 Browsers... :?
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Tom, Tech Support
Posts: 3526
Joined: Mon May 31, 2010 4:59 pm

Re: difficulty executing a selection in a drop down menu

Post by Tom, Tech Support » Wed May 15, 2019 9:22 am

chivracq wrote:
Tue May 14, 2019 11:50 pm
Hum, not if the Macro runs in FF or CR, according to the Wiki... :?
Yes, you are correct, I was unaware of this note! I hate when the behavior is not consistent across all versions! I'll have to see if we can get this changed.
Regards,

Tom, iMacros Support
Goldclownfish
Posts: 15
Joined: Mon Apr 29, 2019 3:50 am

Re: difficulty executing a selection in a drop down menu

Post by Goldclownfish » Mon May 20, 2019 6:38 am

Tom, Tech Support wrote:
Wed May 15, 2019 9:22 am
chivracq wrote:
Tue May 14, 2019 11:50 pm
Hum, not if the Macro runs in FF or CR, according to the Wiki... :?
Yes, you are correct, I was unaware of this note! I hate when the behavior is not consistent across all versions! I'll have to see if we can get this changed.
Curious why you allow some user to be mod that uses a super old version thats not even supported in almost all of the current browsers most people use. He must be too cheap to buy the current one. Be really nice if u stopped him from insulting users that come here for help also.
Post Reply