Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Simulating a button click to bypass a prompt

Reply
 
Old 4 Weeks Ago   #1 (permalink)
piancu


 
 

Simulating a button click to bypass a prompt

Hi everyone. I'm trying to use VB script to load a table from a HTML
page to a text file. The problem is that the webpage has a EULA
agreement prompt which i need to get past in order to download the
table. I get an error message about button sometimes but at times the
button is being clicked, although IE.document.body is non-existent and
nothing gets written to the file.

Do any of you know how I can click the button that appears but at the
same time be able to access the document body of the page I get to.

Thanks
Paul

Dim strContents
Dim row
Dim Tables, Table
Dim IE, IE2, IE3
Dim TableData, Td, Tr, Trs
Dim Data, Data1
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
optout/oregon_optout.html")
Do While IE.Busy
Loop
wscript.sleep(100)

strContents = Space(1)
IE.document.getElementbyID("eula-accept").click()

Set Tables = IE.document.Body.getElementsbyTagName("table")

Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile("\\db1\production\Files
\MedicareOptoutProviderList\medicareoptout.txt", 2, True)

For Each Table In Tables
Set TableData = Tables.Item(0)
Set Trs = TableData.getElementsbyTagName("tr")
For Each Tr In Trs
Set Data = Tr.getElementsbyTagName("td")
For Each Td In Data
row = row & Td.innertext & vbTab
Next
row = Replace(row, vbCrLf, strContents)
WriteStuff.WriteLine(row)
row = ""
Next
Next
WriteStuff.Close
IE.Quit

My System SpecsSystem Spec
Old 3 Weeks Ago   #2 (permalink)
Pegasus [MVP]


 
 

Re: Simulating a button click to bypass a prompt


"piancu" <paul.r.iancu@newsgroup> wrote in message
news:e1f622dc-d889-407b-bcf7-12761ee94675@newsgroup
Quote:

> Hi everyone. I'm trying to use VB script to load a table from a HTML
> page to a text file. The problem is that the webpage has a EULA
> agreement prompt which i need to get past in order to download the
> table. I get an error message about button sometimes but at times the
> button is being clicked, although IE.document.body is non-existent and
> nothing gets written to the file.
>
> Do any of you know how I can click the button that appears but at the
> same time be able to access the document body of the page I get to.
>
> Thanks
> Paul
>
> Dim strContents
> Dim row
> Dim Tables, Table
> Dim IE, IE2, IE3
> Dim TableData, Td, Tr, Trs
> Dim Data, Data1
> Set IE = CreateObject("InternetExplorer.Application")
> IE.Visible = True
> IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
> optout/oregon_optout.html")
> Do While IE.Busy
> Loop
> wscript.sleep(100)
>
> strContents = Space(1)
> IE.document.getElementbyID("eula-accept").click()
>
> Set Tables = IE.document.Body.getElementsbyTagName("table")
>
> Set myFSO = CreateObject("Scripting.FileSystemObject")
> Set WriteStuff = myFSO.OpenTextFile("\\db1\production\Files
> \MedicareOptoutProviderList\medicareoptout.txt", 2, True)
>
> For Each Table In Tables
> Set TableData = Tables.Item(0)
> Set Trs = TableData.getElementsbyTagName("tr")
> For Each Tr In Trs
> Set Data = Tr.getElementsbyTagName("td")
> For Each Td In Data
> row = row & Td.innertext & vbTab
> Next
> row = Replace(row, vbCrLf, strContents)
> WriteStuff.WriteLine(row)
> row = ""
> Next
> Next
> WriteStuff.Close
> IE.Quit
If you open the three web pages below in the shown order then you should be
able to access your table:

1. https://www.noridianmedicare.com/p-m...on_optout.html
2. https://www.noridianmedicare.com/eul...oll%2F&agree=1
3. https://www.noridianmedicare.com/p-m...on_optout.html


My System SpecsSystem Spec
Old 3 Weeks Ago   #3 (permalink)
piancu


 
 

Re: Simulating a button click to bypass a prompt

On Oct 30, 3:17*am, "Pegasus [MVP]" <n...@newsgroup> wrote:
Quote:

> "piancu" <paul.r.ia...@newsgroup> wrote in message
>
> news:e1f622dc-d889-407b-bcf7-12761ee94675@newsgroup
>
>
>
>
>
Quote:

> > Hi everyone. I'm trying to use VB script to load a table from a HTML
> > page to a text file. The problem is that the webpage has a EULA
> > agreement prompt which i need to get past in order to download the
> > table. I get an error message about button sometimes but at times the
> > button is being clicked, although IE.document.body is non-existent and
> > nothing gets written to the file.
>
Quote:

> > Do any of you know how I can click the button that appears but at the
> > same time be able to access the document body of the page I get to.
>
Quote:

> > Thanks
> > Paul
>
Quote:

> > * *Dim strContents
> > * *Dim row
> > * *Dim Tables, Table
> > * *Dim IE, IE2, IE3
> > * *Dim TableData, Td, Tr, Trs
> > * *Dim Data, Data1
> > * *Set IE = CreateObject("InternetExplorer.Application")
> > * *IE.Visible = True
> > * *IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
> > optout/oregon_optout.html")
> > * *Do While IE.Busy
> > * *Loop
> > * *wscript.sleep(100)
>
Quote:

> > * *strContents = Space(1)
> > * *IE.document.getElementbyID("eula-accept").click()
>
Quote:

> > * *Set Tables = IE.document.Body.getElementsbyTagName("table")
>
Quote:

> > * *Set myFSO = CreateObject("Scripting.FileSystemObject")
> > * *Set WriteStuff = myFSO.OpenTextFile("\\db1\production\Files
> > \MedicareOptoutProviderList\medicareoptout.txt", 2, True)
>
Quote:

> > * *For Each Table In Tables
> > * * * *Set TableData = Tables.Item(0)
> > * * * *Set Trs = TableData.getElementsbyTagName("tr")
> > * * * *For Each Tr In Trs
> > * * * * * *Set Data = Tr.getElementsbyTagName("td")
> > * * * * * *For Each Td In Data
> > * * * * * * * *row = row & Td.innertext & vbTab
> > * * * * * *Next
> > * * * * * *row = Replace(row, vbCrLf, strContents)
> > * * * * * *WriteStuff.WriteLine(row)
> > * * * * * *row = ""
> > * * * *Next
> > * *Next
> > * *WriteStuff.Close
> > * *IE.Quit
>
> If you open the three web pages below in the shown order then you should be
> able to access your table:
>
> 1.https://www.noridianmedicare.com/p-m...on_optout.html
> 2.https://www.noridianmedicare.com/eul...Fenroll%2F&agr....
> 3.https://www.noridianmedicare.com/p-m...n_optout.html- Hide quoted text -
>
> - Show quoted text -


Thank You! The navigation works but the document body doesn't seem to
have anything in it.

IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
optout/oregon_optout.html")
Do While IE.Busy
Loop
IE.Navigate ("https://www.noridianmedicare.com/%2Fp-medb%2Fenroll
%2F&agree=1")
Do While IE.Busy
Loop
IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
optout/oregon_optout.html")
Do While IE.Busy
Loop
wscript.sleep(100)

strContents = Space(1)

Set Tables = IE.document.Body.getElementsbyTagName("table")
My System SpecsSystem Spec
Old 3 Weeks Ago   #4 (permalink)
piancu


 
 

Re: Simulating a button click to bypass a prompt

On Oct 30, 11:07*am, piancu <paul.r.ia...@newsgroup> wrote:
Quote:

> On Oct 30, 3:17*am, "Pegasus [MVP]" <n...@newsgroup> wrote:
>
>
>
>
>
Quote:

> > "piancu" <paul.r.ia...@newsgroup> wrote in message
>
Quote:

> >news:e1f622dc-d889-407b-bcf7-12761ee94675@newsgroup
>
Quote:
Quote:

> > > Hi everyone. I'm trying to use VB script to load a table from a HTML
> > > page to a text file. The problem is that the webpage has a EULA
> > > agreement prompt which i need to get past in order to download the
> > > table. I get an error message about button sometimes but at times the
> > > button is being clicked, although IE.document.body is non-existent and
> > > nothing gets written to the file.
>
Quote:
Quote:

> > > Do any of you know how I can click the button that appears but at the
> > > same time be able to access the document body of the page I get to.
>
Quote:
Quote:

> > > Thanks
> > > Paul
>
Quote:
Quote:

> > > * *Dim strContents
> > > * *Dim row
> > > * *Dim Tables, Table
> > > * *Dim IE, IE2, IE3
> > > * *Dim TableData, Td, Tr, Trs
> > > * *Dim Data, Data1
> > > * *Set IE = CreateObject("InternetExplorer.Application")
> > > * *IE.Visible = True
> > > * *IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
> > > optout/oregon_optout.html")
> > > * *Do While IE.Busy
> > > * *Loop
> > > * *wscript.sleep(100)
>
Quote:
Quote:

> > > * *strContents = Space(1)
> > > * *IE.document.getElementbyID("eula-accept").click()
>
Quote:
Quote:

> > > * *Set Tables = IE.document.Body.getElementsbyTagName("table")
>
Quote:
Quote:

> > > * *Set myFSO = CreateObject("Scripting.FileSystemObject")
> > > * *Set WriteStuff = myFSO.OpenTextFile("\\db1\production\Files
> > > \MedicareOptoutProviderList\medicareoptout.txt", 2, True)
>
Quote:
Quote:

> > > * *For Each Table In Tables
> > > * * * *Set TableData = Tables.Item(0)
> > > * * * *Set Trs = TableData.getElementsbyTagName("tr")
> > > * * * *For Each Tr In Trs
> > > * * * * * *Set Data = Tr.getElementsbyTagName("td")
> > > * * * * * *For Each Td In Data
> > > * * * * * * * *row = row & Td.innertext & vbTab
> > > * * * * * *Next
> > > * * * * * *row = Replace(row, vbCrLf, strContents)
> > > * * * * * *WriteStuff.WriteLine(row)
> > > * * * * * *row = ""
> > > * * * *Next
> > > * *Next
> > > * *WriteStuff.Close
> > > * *IE.Quit
>
Quote:

> > If you open the three web pages below in the shown order then you should be
> > able to access your table:
>>
Quote:

> > - Show quoted text -
>
> Thank You! The navigation works but the document body doesn't seem to
> have anything in it.
>
> * * IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
> optout/oregon_optout.html")
> * * Do While IE.Busy
> * * Loop
> * * IE.Navigate ("https://www.noridianmedicare.com/%2Fp-medb%2Fenroll
> %2F&agree=1")
> * * Do While IE.Busy
> * * Loop
> * * IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
> optout/oregon_optout.html")
> * * Do While IE.Busy
> * * Loop
> * * wscript.sleep(100)
>
> * * strContents = Space(1)
>
> * * Set Tables = IE.document.Body.getElementsbyTagName("table")- Hide quoted text -
>
> - Show quoted text -
I found the problem. I had to use the url of the I Agree button, the
url that appears at the bottom of the browser window when the mouse is
over the button.

IE.Navigate ("https://www.noridianmedicare.com/eula.php?t=%2Fp-medb
%2Fenroll%2Foptout2Foregon_optout.html&agree=1")
My System SpecsSystem Spec
Old 3 Weeks Ago   #5 (permalink)
Pegasus [MVP]


 
 

Re: Simulating a button click to bypass a prompt


"piancu" <paul.r.iancu@newsgroup> wrote in message
news:6a962ee1-e96a-496d-bc2d-e36305890821@newsgroup
On Oct 30, 11:07 am, piancu <paul.r.ia...@newsgroup> wrote:
Quote:

> On Oct 30, 3:17 am, "Pegasus [MVP]" <n...@newsgroup> wrote:
>
>
>
>
>
Quote:

> > "piancu" <paul.r.ia...@newsgroup> wrote in message
>
Quote:

> >news:e1f622dc-d889-407b-bcf7-12761ee94675@newsgroup
>
Quote:
Quote:

> > > Hi everyone. I'm trying to use VB script to load a table from a HTML
> > > page to a text file. The problem is that the webpage has a EULA
> > > agreement prompt which i need to get past in order to download the
> > > table. I get an error message about button sometimes but at times the
> > > button is being clicked, although IE.document.body is non-existent and
> > > nothing gets written to the file.
>
Quote:
Quote:

> > > Do any of you know how I can click the button that appears but at the
> > > same time be able to access the document body of the page I get to.
>
Quote:
Quote:

> > > Thanks
> > > Paul
>
Quote:
Quote:

> > > Dim strContents
> > > Dim row
> > > Dim Tables, Table
> > > Dim IE, IE2, IE3
> > > Dim TableData, Td, Tr, Trs
> > > Dim Data, Data1
> > > Set IE = CreateObject("InternetExplorer.Application")
> > > IE.Visible = True
> > > IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
> > > optout/oregon_optout.html")
> > > Do While IE.Busy
> > > Loop
> > > wscript.sleep(100)
>
Quote:
Quote:

> > > strContents = Space(1)
> > > IE.document.getElementbyID("eula-accept").click()
>
Quote:
Quote:

> > > Set Tables = IE.document.Body.getElementsbyTagName("table")
>
Quote:
Quote:

> > > Set myFSO = CreateObject("Scripting.FileSystemObject")
> > > Set WriteStuff = myFSO.OpenTextFile("\\db1\production\Files
> > > \MedicareOptoutProviderList\medicareoptout.txt", 2, True)
>
Quote:
Quote:

> > > For Each Table In Tables
> > > Set TableData = Tables.Item(0)
> > > Set Trs = TableData.getElementsbyTagName("tr")
> > > For Each Tr In Trs
> > > Set Data = Tr.getElementsbyTagName("td")
> > > For Each Td In Data
> > > row = row & Td.innertext & vbTab
> > > Next
> > > row = Replace(row, vbCrLf, strContents)
> > > WriteStuff.WriteLine(row)
> > > row = ""
> > > Next
> > > Next
> > > WriteStuff.Close
> > > IE.Quit
>
Quote:

> > If you open the three web pages below in the shown order then you should
> > be
> > able to access your table:
>>
Quote:

> > - Show quoted text -
>
> Thank You! The navigation works but the document body doesn't seem to
> have anything in it.
>
> IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
> optout/oregon_optout.html")
> Do While IE.Busy
> Loop
> IE.Navigate ("https://www.noridianmedicare.com/%2Fp-medb%2Fenroll
> %2F&agree=1")
> Do While IE.Busy
> Loop
> IE.Navigate ("https://www.noridianmedicare.com/p-medb/enroll/
> optout/oregon_optout.html")
> Do While IE.Busy
> Loop
> wscript.sleep(100)
>
> strContents = Space(1)
>
> Set Tables = IE.document.Body.getElementsbyTagName("table")- Hide quoted
> text -
>
> - Show quoted text -
I found the problem. I had to use the url of the I Agree button, the
url that appears at the bottom of the browser window when the mouse is
over the button.

IE.Navigate ("https://www.noridianmedicare.com/eula.php?t=%2Fp-medb
%2Fenroll%2Foptout2Foregon_optout.html&agree=1")

=============

Thanks for the feedback.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Visual Basic simple Prompt window with Minimize button VB Script
Click Once Publish from DOS prompt. .NET General
New tool available to selectively bypass the UAC prompt Vista General
How to click a mouse button Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46