Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #11890 > unrolled thread
| Started by | gerald.bell@pnmac.com |
|---|---|
| First post | 2018-04-16 10:57 -0700 |
| Last post | 2018-04-17 10:39 -0400 |
| Articles | 10 — 3 participants |
Back to article view | Back to microsoft.public.scripting.vbscript
ie automation gerald.bell@pnmac.com - 2018-04-16 10:57 -0700
Re: ie automation "Mayayana" <mayayana@invalid.nospam> - 2018-04-16 19:09 -0400
Re: ie automation "Mayayana" <mayayana@invalid.nospam> - 2018-04-16 21:50 -0400
Re: ie automation JJ <jj4public@vfemail.net> - 2018-04-17 16:35 +0700
Re: ie automation gerald.bell@pnmac.com - 2018-04-17 05:48 -0700
Re: ie automation "Mayayana" <mayayana@invalid.nospam> - 2018-04-17 09:42 -0400
Re: ie automation gerald.bell@pnmac.com - 2018-04-17 06:59 -0700
Re: ie automation gerald.bell@pnmac.com - 2018-04-17 07:33 -0700
Re: ie automation gerald.bell@pnmac.com - 2018-04-17 07:39 -0700
Re: ie automation "Mayayana" <mayayana@invalid.nospam> - 2018-04-17 10:39 -0400
| From | gerald.bell@pnmac.com |
|---|---|
| Date | 2018-04-16 10:57 -0700 |
| Subject | ie automation |
| Message-ID | <ecdf55bb-9fe4-4451-a134-7abe3d845254@googlegroups.com> |
Hi. There is an IE website I am trying to automate. But there is no ID of the field.. Here is part of the code... <div class="option" data-selectable data-value="881">Report 1</div> <div class="option selected active" data-selectable data-value="888">Report 2</div> <div class="option" data-selectable data-value="889">Report 3</div> ... I am not sure what the vbs syntax would be to make the Report 3 be selected active and the rest not active. Please help. Thanks in advance....
[toc] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2018-04-16 19:09 -0400 |
| Message-ID | <pb3afu$qso$1@dont-email.me> |
| In reply to | #11890 |
<gerald.bell@pnmac.com> wrote | I am not sure what the vbs syntax would be to make the Report 3 be selected active and the rest not active. | An OPTION is a type of tag. Naming a DIV class as "option" doesn't make it an OPTION element. Why aren't you just using OPTION?
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2018-04-16 21:50 -0400 |
| Message-ID | <pb3jte$bbi$1@dont-email.me> |
| In reply to | #11890 |
<gerald.bell@pnmac.com> wrote .... Looking at this again, it appears you're using some kind of javascript wrapper class. That's not IE document object model. Whether you can use VBS with it, I don't know. But if you're going to use pre-cooked script libraries you'll probably need to use pre-cooked methods to access them. In other words, if you're using some kind of javascript class, like "selectjs" or some such, then it will have its own methods to deal with selection. data-* attributes are custom. They have no specific meaning, only allowing you to store data. If you want to do something like make #3 "selected" and the others not, without using OPTION buttons or checkboxes, then it's up to you. You're doing it from scratch, so you can do as you like. I guess if it were me I'd do something like change the border and/or background color when the item is selected. If this hasn't been helpful then it might be a good idea to post more of your code and explain more of what you're trying to do.
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2018-04-17 16:35 +0700 |
| Message-ID | <1f98brxu2fa2d$.f2ccb6j5o3nr$.dlg@40tude.net> |
| In reply to | #11890 |
On Mon, 16 Apr 2018 10:57:05 -0700 (PDT), gerald.bell@pnmac.com wrote: > Hi. There is an IE website I am trying to automate. But there is no ID of the field.. Here is part of the code... > > <div class="option" data-selectable data-value="881">Report 1</div> > > <div class="option selected active" data-selectable data-value="888">Report 2</div> > > <div class="option" data-selectable data-value="889">Report 3</div> > > .... > > I am not sure what the vbs syntax would be to make the Report 3 be selected active and the rest not active. > > Please help. > > Thanks in advance.... If you have MSIE v10+, you can use the `documentQuerySelector()` method of the `document` object to select the element based on the `data-value` attribute's value. i.e. with below selector. .option[data-value="889"] If your MSIE is older than v10, the `documentQuerySelector()` method is not yet exist. So, you'll have to manually search for the element by first selecting all elements whose class name is `option` using `getElementsByClassName()`. Then enumerate the found elements using a loop to check the presence of the `data-value` attribute, and if it exists, check its value. If you get multiple matches, you might also want to check the element's contents for a "Report 3" string. If there are still multiple matches, identify the element based on its location within the document structure. e.g. the third direct child element (i.e. relative element index); parent element tag name, ID, class name, or attribute(s); element index of the parent element; identification of the next node sibling (which can be a text or an element); etc. There are numerous properties and combinations which can be used.
[toc] | [prev] | [next] | [standalone]
| From | gerald.bell@pnmac.com |
|---|---|
| Date | 2018-04-17 05:48 -0700 |
| Message-ID | <9c76c882-07a8-46ea-9056-bb8527a12764@googlegroups.com> |
| In reply to | #11890 |
Hi. My original intent was to find some way to automate a SELECT dropwon that is selectized.. It looks like there may be a better way of doing this.. the selectized dropdowns are new to me. I found out about them only after my vbs code to select/change them directly did not work. Is there another way of selecting/changing selectized dropdowns? It looks like there is an inherent script that runs whenever an option is selected.. based on my research of selectized dropdowns (i am thinking selectize.js). But is there any way I can select values from a selectized IE dropdown? On Monday, April 16, 2018 at 12:57:08 PM UTC-5, geral...@pnmac.com wrote: > Hi. There is an IE website I am trying to automate. But there is no ID of the field.. Here is part of the code... > > <div class="option" data-selectable data-value="881">Report 1</div> > > <div class="option selected active" data-selectable data-value="888">Report 2</div> > > <div class="option" data-selectable data-value="889">Report 3</div> > > ... > > > I am not sure what the vbs syntax would be to make the Report 3 be selected active and the rest not active. > > Please help. > > Thanks in advance....
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2018-04-17 09:42 -0400 |
| Message-ID | <pb4tlh$2sl$1@dont-email.me> |
| In reply to | #11894 |
<gerald.bell@pnmac.com> wrote
> But is there any way I can select values from a selectized IE dropdown?
I still don't know what you're saying. :)
You want to set the selected item? Or
retrieve a value? This sample should
demonstrate your options:
<HTML><HEAD>
<SCRIPT LANGUAGE="VBScript">
Sub window_onload()
For i = 1 to 8
Set Opt = document.createElement("OPTION")
Opt.text = CStr(i)
Opt.value = CStr(i)
dropbox.add Opt
Set Opt = Nothing
Next
'-- note this will show "6" because the index is 0-based.
dropbox.selectedIndex = 5
End Sub
Sub dropbox_onchange()
Lab1.innerText = dropbox.value
End Sub
</SCRIPT>
</HEAD>
<BODY>
<SELECT ID="dropbox" SIZE=1>
</SELECT>
<LABEL ID="Lab1"></LABEL>
</BODY></HTML>
------------------------------
You can also write subs for click and
doubleclick events. For instance, if you
want multi-select, you could set the size
above to 8, then retrieve the selectedIndex
with each click or onchange, then do
something like set the backcolor red for
that item and keep a record of which
are red. A javascript library is doing the
dsame thing. It's just packaging the details.
You might want to get the help file for this.
It's hard if you don't have a reference because
the document object model is so vast. In this
case you'd want the DHTML help. I keep a
snippet of instructions for just this kind of
thing:
1)
This link should work to get the real ISO of the Win7 SDK
rather than a nonsense "web installer" link:
https://download.microsoft.com/download/2/E/9/2E911956-F90F-4BFB-8231-E292A7B6F287/GRMSDK_EN_DVD.iso
Otherwise, try this and make sure you get the
X86 version:
https://www.microsoft.com/en-us/download/details.aspx?id=18950
2)
Open the ISO using 7-Zip. Inside the Setup\WinSDKDocWin32
folder, take out cab5.cab. Inside that, find and extract this file:
WinSDK_DHTML_hxs_......
3)
Go here to get the HXS to CHM converter:
https://www.jsware.net/jsware/hxs2chm.php5
(You'll also need to download Microsoft's free
HTML Help Workshop.)
4)
With that you can get yourself a WMI CHM reference that
includes all methods, classes, etc. The HXS to CHM converter
might require a bit of setup -- it needs the help workshop
and 7-Zip paths to work -- but once set up the conversion
is basically a 1-click operation.
Anyone who wants other docs might want to convert
the whole shebang: Extract all 6 CABs from the help folder
and use the converter to convert them all to CHM in one
shot. Then you get Windows Script Host, IE DOM, shell....
pretty much anything that MS has docs for -- which takes
forever to look up online -- has a corresponding help file.
With that you end up with full, accessible, local help,
but without the gargantuan bloat of a full Windows SDK
installation, and without the help files being limited
in terms of how you can read them. All Windows versions
support CHM help files as a native format.
[toc] | [prev] | [next] | [standalone]
| From | gerald.bell@pnmac.com |
|---|---|
| Date | 2018-04-17 06:59 -0700 |
| Message-ID | <7895bece-c24a-4eb8-8a81-740ae3854814@googlegroups.com> |
| In reply to | #11890 |
On Monday, April 16, 2018 at 12:57:08 PM UTC-5, geral...@pnmac.com wrote: > Hi. There is an IE website I am trying to automate. But there is no ID of the field.. Here is part of the code... > > <div class="option" data-selectable data-value="881">Report 1</div> > > <div class="option selected active" data-selectable data-value="888">Report 2</div> > > <div class="option" data-selectable data-value="889">Report 3</div> > > ... > > > I am not sure what the vbs syntax would be to make the Report 3 be selected active and the rest not active. > > Please help. > > Thanks in advance.... Hi. Simply trying to call the validation event behind the dropdown. But since this is a selectize dropdown, there is no OnClick event. Here is some info on selectized dropdowns: https://github.com/selectize/selectize.js/blob/master/docs/api.md Notice there is no Onclick event. I am simply trying to call maybe the getOption() event. But when I use the followingin my vbscript file I am getting a "object doesn't support this property or method" error.
[toc] | [prev] | [next] | [standalone]
| From | gerald.bell@pnmac.com |
|---|---|
| Date | 2018-04-17 07:33 -0700 |
| Message-ID | <aabab076-c68d-46cf-a3bf-63392e4581e9@googlegroups.com> |
| In reply to | #11896 |
On Tuesday, April 17, 2018 at 8:59:13 AM UTC-5, geral...@pnmac.com wrote: > On Monday, April 16, 2018 at 12:57:08 PM UTC-5, geral...@pnmac.com wrote: > > Hi. There is an IE website I am trying to automate. But there is no ID of the field.. Here is part of the code... > > > > <div class="option" data-selectable data-value="881">Report 1</div> > > > > <div class="option selected active" data-selectable data-value="888">Report 2</div> > > > > <div class="option" data-selectable data-value="889">Report 3</div> > > > > ... > > > > > > I am not sure what the vbs syntax would be to make the Report 3 be selected active and the rest not active. > > > > Please help. > > > > Thanks in advance.... > > Hi. Simply trying to call the validation event behind the dropdown. But since this is a selectize dropdown, there is no OnClick event. Here is some info on selectized dropdowns: > https://github.com/selectize/selectize.js/blob/master/docs/api.md > Notice there is no Onclick event. I am simply trying to call maybe the getOption() event. But when I use the followingin my vbscript file I am getting a "object doesn't support this property or method" error. If you need the full code of the selectize.js from my site please let me know. It looks like there is no getoption() event in it, but there are a lot of other events. trying to figure out which one is called when a user selects an option from the dropdown, and call that from my vbscript.
[toc] | [prev] | [next] | [standalone]
| From | gerald.bell@pnmac.com |
|---|---|
| Date | 2018-04-17 07:39 -0700 |
| Message-ID | <cacf4456-17d6-4c9b-9eca-fa85461b32f9@googlegroups.com> |
| In reply to | #11897 |
On Tuesday, April 17, 2018 at 9:33:49 AM UTC-5, geral...@pnmac.com wrote: > On Tuesday, April 17, 2018 at 8:59:13 AM UTC-5, geral...@pnmac.com wrote: > > On Monday, April 16, 2018 at 12:57:08 PM UTC-5, geral...@pnmac.com wrote: > > > Hi. There is an IE website I am trying to automate. But there is no ID of the field.. Here is part of the code... > > > > > > <div class="option" data-selectable data-value="881">Report 1</div> > > > > > > <div class="option selected active" data-selectable data-value="888">Report 2</div> > > > > > > <div class="option" data-selectable data-value="889">Report 3</div> > > > > > > ... > > > > > > > > > I am not sure what the vbs syntax would be to make the Report 3 be selected active and the rest not active. > > > > > > Please help. > > > > > > Thanks in advance.... > > > > Hi. Simply trying to call the validation event behind the dropdown. But since this is a selectize dropdown, there is no OnClick event. Here is some info on selectized dropdowns: > > https://github.com/selectize/selectize.js/blob/master/docs/api.md > > Notice there is no Onclick event. I am simply trying to call maybe the getOption() event. But when I use the followingin my vbscript file I am getting a "object doesn't support this property or method" error. > > If you need the full code of the selectize.js from my site please let me know. It looks like there is no getoption() event in it, but there are a lot of other events. trying to figure out which one is called when a user selects an option from the dropdown, and call that from my vbscript. looks like there is indeed an getoption event/function in it. just trying to figure out how to call the functions in the selectize.js using vbs
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2018-04-17 10:39 -0400 |
| Message-ID | <pb5110$6hb$1@dont-email.me> |
| In reply to | #11896 |
<gerald.bell@pnmac.com> wrote | Hi. Simply trying to call the validation event behind the dropdown. But since this is a selectize dropdown, there is no OnClick event. Here is some info on selectized dropdowns: | https://github.com/selectize/selectize.js/blob/master/docs/api.md | Notice there is no Onclick event. I am simply trying to call maybe the getOption() event. But when I use the followingin my vbscript file I am getting a "object doesn't support this property or method" error. | You're on your own with that. It's a wrapper that has nothing to do with IE directly, and nothing to do with VBS. You'll need the selectize.js docs, if there are any. You'll probably want to ask in a forum for javascript "libraries". That's a whole different world: People with little scripting experience who are trying to set up interactive websites. From what I've seen it seems to be a semi-WYSIWYG scenario: People trading snippets of code to accomplish specific things, using vastly complex js wrappers. This group is for people who are actually doing the scripting themselves, and using VBS. Many people here know about the IE document object model, but that doesn't help you if you're using a custom wrapper.
[toc] | [prev] | [standalone]
Back to top | Article view | microsoft.public.scripting.vbscript
csiph-web