![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: How Do I Access an EXISTING Internet Explorer Window Topic Summary: Created On: 05/21/2018 10:46 PM Status: Post and Reply |
|
![]() |
![]() |
- AlexF | - 05/21/2018 10:46 PM |
![]() |
![]() |
- PG LTU | - 05/22/2018 10:51 AM |
![]() |
![]() |
- AlexF | - 05/22/2018 03:23 PM |
![]() |
![]() |
- PG LTU | - 05/22/2018 06:14 PM |
![]() |
![]() |
- AlexF | - 05/22/2018 10:23 PM |
![]() |
![]() |
- PG LTU | - 05/23/2018 10:49 AM |
![]() |
![]() |
- AlexF | - 05/23/2018 11:55 AM |
![]() |
![]() |
- PG LTU | - 05/23/2018 04:07 PM |
![]() |
![]() |
- AlexF | - 05/24/2018 05:38 PM |
![]() |
![]() |
- AlexF | - 05/24/2018 07:15 PM |
![]() |
![]() |
- Lunis Orcutt | - 05/24/2018 07:46 PM |
![]() |
![]() |
- AlexF | - 05/24/2018 07:57 PM |
![]() |
![]() |
- PG LTU | - 05/25/2018 09:42 AM |
![]() |
|
I need to manipulate an IE window once it is already open, not launch a new IE window.
Specifically, I spend a lot of time doing research in a special database (Westlaw), and - when I find a case which is helpful - I will run a vba command which saves the webpage to my computer, using vba to click various buttons, etc.
It wouldn't be useful to create a new IE window, by using the normal Set IE = New InternetExplorer command, because then I'd lose the case, and have to log in to the database all over again. I need to start with the webpage I'm on, and then manipulate the open webpage.
I've tried things like substituting Set IE = GetObject(, "InternetExplorer.Application") instead of Set IE = New InternetExplorer
But nothing's working. Any tips? ------------------------- I'm using KnowBrainer 17 and Dragon Professional Individual version 14. |
|
|
|
![]() |
|
Here's a tip: Open the shell object, iterate through all open windows (you will get both Explorer and IE windows and tabs) looking for a title or text, and when you find it, save that one to your IE object. Simple, I've explained it all before:
http://www.knowbrainer.com/forums/forum/messageview.cfm?catid=12&threadid=23806
Also, if it's the active IE window you are in, then it is even easier. Here is an older example (it's a ways down near the bottom of the thread):
http://www.knowbrainer.com/forums/forum/messageview.cfm?catid=12&threadid=21027
Let us know how you make out . . . -------------------------
|
|
|
|
![]() |
|
PG,
When I try to use the second technique, I get the following error:
Am I not using the right reference libraries? Or is this a problem with my computer (e.g. dll files)? I'm going crazy trying to figure this out. ------------------------- I'm using KnowBrainer 17 and Dragon Professional Individual version 14. |
|
|
|
![]() |
|
Still works for me. No external references needed. Make Google the active IE page and the active window, but make sure you click outside the google search box so the cursor is not blinking in it. Then issue this command and watch as 5 seconds later the cursor shows up there ready for you to dictate your query: -------------------------
|
|
|
|
![]() |
|
Your script worked perfectly. However, when I change
wb.Document.getElementByID("lst-ib").focus()
to either
wb.Document.getElementsByClassName("btnK").click()
or
wb.Document.getElementsByName("btnK").click()
I get the same error message. So I must be doing something wrong in how I write the click command.
By the way, when I instead use
wb.Document.getElementsByName("btnK").Item(0).click()
Then I get the following error:
(10094) ActiveX Automation: Object var is ‘Nothing”.
I can't figure out what I'm doing wrong ... I can't even click the Google search button. ------------------------- I'm using KnowBrainer 17 and Dragon Professional Individual version 14. |
|
|
|
![]() |
|
Oh so close. Did you search for the vba syntax? Here it is:
wb.Document.getElementsByName("q")(0).focus() ' focus on search input box by element name
Now you should have some fun . . . -------------------------
|
|
|
|
![]() |
|
PG,
If I leave in both of these lines:
wb.Document.getElementByID("lst-ib").focus()
I get the error
(10510) Not an object reference.
If I delete the focus line and only include wb.Document.getElementsByName("btnK")(0).click()
I get the error
(10094) ActiveX Automation: Object var is ‘Nothing’.
I'm using a brand new HP Pavillion laptop, so there's no way my .dll files are corrupted.
By the way, I don't know a good source for searching VBA syntax. I read Larry Allen's book, and find examples on Know Brainer, Stack Exchange, etc. I find actual Microsoft discussions hard to read. ------------------------- I'm using KnowBrainer 17 and Dragon Professional Individual version 14. |
|
|
|
![]() |
|
Sure, I get it - it can seem intractable. I had to click a few links before getting enough info to trial and error it. I searched "vba getelements by name" to get a collection of links. Anyway, we'll get you going. Pls provide your whole script. Here's mine:
Remember, the IE tab must be the active window. -------------------------
|
|
|
|
![]() |
|
PG, I am very grateful for all of your assistance. I can't get anything to work at this point.
I wonder if part of the problem is that the websites I'm trying to control are using hidden frames. Westlaw's code doesn't show frames ... but I think there are hidden frames, because clicking buttons doesn't change the url. The url stays constant even when I'm clicking through to download cases.
And I see references to frames at Google.
I think I may have to put this on hold until I have more time to try to get to the bottom of it. ------------------------- I'm using KnowBrainer 17 and Dragon Professional Individual version 14. |
|
|
|
![]() |
|
BTW, Westlaw is a really wierd website. For example, if I try to use KnowBrainer's "Display Numbers" functions, the download buttons I want to click will have different numbers each time. ------------------------- I'm using KnowBrainer 17 and Dragon Professional Individual version 14. |
|
|
|
![]() |
|
Alex, the DISPLAY Numbers command works the same way on most complex websites, Windows and programs. In other words the numbers change depending on how this feature reads the window so creating a command that utilizes KnowBrainer's DISPLAY Numbers feature, which is available in KnowBrainer VerbalBasic, would unfortunately be unreliable. This feature will work faster in the DPI15 Upgrade, but no better than it does in your current DPI 14. However, if your browser is always kept in the same position or maximized, you could create KnowBrainer mouse commands, which are considered to be a last resort but relatively easy to create. You will find details on this procedure in your VerbalBasic Manual or we can assist you with writing them on your computer virtually. ------------------------- Change "No" to "Know" w/KnowBrainer 2020 |
|
|
|
![]() |
|
Thank you, Lunis. Amusingly, even the mouse positions change for the download buttons on the Westlaw website, even though the pop-up boxes would appear to hold a fixed position. It is horribly programmed for usability.
Probably the most sure-fire way to click the buttons is to use a rapid-fire cluster of mouse clicks - including several positions a little above and several a little below the average button position - to make sure that one of them strikes gold. ------------------------- I'm using KnowBrainer 17 and Dragon Professional Individual version 14. |
|
|
|
![]() |
|
Btw, AlexF, yes, as you noticed, controlling IE by the DOM doesn't work for the stuff served up by AJAX or PHP (and other CMS stacks) because that content is produced dynamically by the browser and is thus not visible to the DOM (which just sees the container, not the content).
There _are_ ways, though. Some tools: First thing, go get yourself the list of keyboard shortcuts and write the scripts to use them. Second, find a "fixed" place that you can focus on, and then count "tabs" to a control you want (if it doesn't change, you can script that). Third, there are tools (I use ahk) that let you figure out what color pixel is under the mouse. You can use this to find buttons or other controls. Lastly, sometimes you can use the location bar to directly enter the javascript or other code that your control wants to send back to the server. Hth, -------------------------
|
|
|
FuseTalk Standard Edition v4.0 - © 1999-2022 FuseTalk™ Inc. All rights reserved.