Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #11708
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | Re: fill in ie form with java |
| Date | 2017-07-09 13:46 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <ojtpug$87s$1@dont-email.me> (permalink) |
| References | <f4606ee4-abaa-49b4-9c5e-922fe8240ced@googlegroups.com> |
"smbs" <stevenbe@gmail.com> wrote |I am trying to select items from a dropdown menu on a javascript webpage. I want to fill in the menu value via a userform using VB. Relevent Web code source is below | Are you in the page? If so then either of the following options will work. You don't need the inefficiency of "all". <HTML> <HEAD> <SCRIPT LANGUAGE="VBScript"> Sub But1_onclick() 'List1.selectedIndex = 3 List1.value = "FR" End Sub </SCRIPT> </HEAD> <BODY> <SELECT ID="List1"> <option value="RU">Russian Federation <option value="US">United States <option value="ES">Spain <option value="FR">France <option value="OTHER">Other Country </SELECT> <INPUT ID="But1" TYPE="button"></input> </BODY></HTML> The NAME attribute also seems to work in place of ID. This is all only in IE, of course. And with any IE webpage code these days you need to consider quirks mode vs non-quirks. Also note that if it's not an HTA then IE11 won't recognize VBS unless you set compat mode for the domain. (I'm not sure how that works locally.) If you're not calling from within the document context then where are you? In that case you need to first get the document reference. If it's not your IE instance then you may not be able to get at the document object, which would then require an API call that's not possible from script. You could try this if necessary: http://www.jsware.net/jsware/compfiles.php5#jsshl It's a component for shell functionality. In addition to things like enumerating windows and getting their handles, it can return an IE document object from IE, an HTA, or any other window that has a true IE browser window in it. The only trick is that IE with tabs makes finding the desired window more tricky. Another thing that might be helpful: http://www.jsware.net/jsware/hxs2chm.php5 That requires a bit of explanation. The IE document object model is vast. You should really have the help docs for it. The problem is that the Inet CHM is about 35 MB and CHMs are no longer made available. All docs are now in the platform SDK, which is a gigantic package. The help files come as HKS files, for which there's no standalone reader. It's a pain to just get basic help files for WSH, IE, etc. The page above links to an HTA utility you can use. Download an SDK. (Win7 would probably be a good choice.) Get out the HXS files, and the utility will convert them. You'll end up with CHM files covering all categories of Windows development. The details to do it are at the link. Once you have an Inet CHM you can easily look up all details of the IE DOM.
Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Find similar | Unroll thread
fill in ie form with java smbs <stevenbe@gmail.com> - 2017-07-09 01:31 -0700
Re: fill in ie form with java "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2017-07-09 04:57 -0400
Re: fill in ie form with java Ulrich Möller <knobbi38@arcor.de> - 2017-07-09 15:52 +0200
Re: fill in ie form with java smbs <stevenbe@gmail.com> - 2017-07-09 08:02 -0700
Re: fill in ie form with java Ulrich Möller <knobbi38@arcor.de> - 2017-07-09 18:49 +0200
Re: fill in ie form with java JJ <jj4public@vfemail.net> - 2017-07-09 23:34 +0700
Re: fill in ie form with java "Mayayana" <mayayana@invalid.nospam> - 2017-07-09 13:46 -0400
csiph-web