Fill in internet explorer drop down box in form using com

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
smbs
Posts: 98
Joined: 27 Feb 2014, 11:07

Re: Fill in internet explorer drop down box in form using com

17 Jul 2017, 16:13

Well thanx to all your help I have come a long way.
Using the javascript above as a google chrome snippet as suggested by sancarn and creating a loop I am able to fill in almost automatically multiple forms using Chrome which was my original request so many thanx to all.
Sancarn
Finally, if you want a list of options you can use this JavaScript function:
Finally, if you want a list of options you can use this JavaScript function:

Code: Select all

function getOptions(element){
	var options=[]
	if(element.tagName!="SELECT") return []
	o = element.options
	for(i in k){if(typeof(k[i])=="object") options.push(k[i].value)}
	return options
}
Used like

Code: Select all

 getOptions(document.querySelector('#address-main > div.sa-form > div:nth-child(4) > div > select'))
Pls could you explain in greater detail how to use this function as I want to try and understand how you obtained the list of options you posted to me.
Many thanx
sancarn
Posts: 224
Joined: 01 Mar 2016, 14:52

Re: Fill in internet explorer drop down box in form using com

18 Jul 2017, 07:00

Let's take this as an example.

On the combobox/dropdown element, on the right hand side of the page - right click and click 'inspect'

You should see the Developer tools pops up and a <select>...</select> is displayed. Right click on this element and choose Copy>Copy selector (ps. this is a feature specific to google chrome)

Now in the javascript console type: getOptions(document.querySelector('<PASTE CLIPBOARD HERE>'))

Run this command and it will return a list of options.

The returned value will be an array: ["volvo", "saab", "opel", "audi"]

P.S.

Make sure the getOptionsfunction is defined first!

Edit:

Apparently there was a mistake in my code. Here is the refined version:

Code: Select all

function getOptions(element){
	var options=[]
	if(element.tagName!="SELECT") return []
	var o = element.options
	for(i in o){if(typeof(o[i])=="object") options.push(o[i].value)}
	return options
}
Last edited by sancarn on 19 Jul 2017, 12:57, edited 1 time in total.
smbs
Posts: 98
Joined: 27 Feb 2014, 11:07

Re: Fill in internet explorer drop down box in form using com

18 Jul 2017, 13:55

sancarn
Many thanx after me being "spoon feed" I really managed to sort things. The "copy selector" was the step I really never understood!
Many many thanx for your patience and help. :D
sancarn
Posts: 224
Joined: 01 Mar 2016, 14:52

Re: Fill in internet explorer drop down box in form using com

19 Jul 2017, 12:56

smbs wrote:sancarn
Many thanx after me being "spoon feed" I really managed to sort things. The "copy selector" was the step I really never understood!
Many many thanx for your patience and help. :D
I did wonder whether that was the case, so decided that a step by step guide would be best :)

You're welcome! Anytime! :D
User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: Fill in internet explorer drop down box in form using com

19 Jul 2017, 15:12

onchange event?
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ArkuS, Google [Bot], Ineedhelplz and 222 guests