How To Fill In An HTML Form On A Web Page Using A Standalone .VBS Script 
Author Message
 How To Fill In An HTML Form On A Web Page Using A Standalone .VBS Script

I have been trying to figure out how to create a VBS
script that will allow me to launch Internet Explorer,
open a specific web page, and fill-in a form on the web
page.

I have gotten as far as launching Internet Explorer and
opening a specific web page with the following code:

'------------------------------------------------------
'A VBScript to create a work order automatically
'
'Steve Cabral May 13, 2002
'------------------------------------------------------
'Variables
Dim objExplorer
Dim objDocument
Dim WshShell

'Launch Internet Explorer
Set objExplorer = WScript.CreateObject
("InternetExplorer.Application")

'Make Internet Explorer visible and select
'work order web page on intranet
objExplorer.Visible = TRUE
objExplorer.Navigate
(" http://www.*-*-*.com/
r/index.php?menu=1")

'Fill-in values in text boxes on form
?????

'Submit the form
?????

'Restore memory being used by Internet Explorer object
Set objExplorer = Nothing

And this is all for my code. So far I can do the basic of
getting this started; however, I can not seem to find a
way or an example of how to set the Internet Explorer
Document object to a local VBScript object so I can
manipulate elements (text boxes on the form) through use
of their IDs and VALUE property.

Has anyone done something like this or know of a source
where I can get information or examples of how this is
done???

My goal is to automate filling out various common work
orders that get submitted on my company's local intranet
through a web page. The only form fiels that really
changes with my common work orders is the description,
room number, and location for each work order. I figure I
can place the commands to create each common (monthly)
work order in VBS files and execute them as needed.



Wed, 10 Nov 2004 03:30:12 GMT  
 How To Fill In An HTML Form On A Web Page Using A Standalone .VBS Script
You access the web document through the browser's--wait for it--document
property! You can manipulate objects on the page just like you can using the
document object in client-side scripts.

Here a Q&D example the fills in a fictitious form and submits it:

Const URL = "http://localhost/flintstones.html"
With WScript.CreateObject("InternetExplorer.Application")
  .Visible = True
  .Navigate URL
  Do Until .ReadyState = 4
    WScript.Sleep 50    ' wait for page to load
  Loop
  With .document.forms("bedrock")
    .fred.value = "text"      ' enter text into a textbox
    .barney.selectedIndex = 2 ' select third option of a select
    .wilma(1).checked = True  ' select second of a group of radio buttons
    .betty(0).checked = True  ' check first
    .betty(2).checked = True  '   and third of a group of checkboxes
    .submit
  End With
End With

WARNING: You'll probably want a more rigorous test for the page's loading.

--
Experience is that marvelous thing that enables you to recognize a mistake when
you make it again. -Franklin P. Jones

=-=-=
Steve
-=-=-


I have been trying to figure out how to create a VBS
script that will allow me to launch Internet Explorer,
open a specific web page, and fill-in a form on the web
page.

I have gotten as far as launching Internet Explorer and
opening a specific web page with the following code:

[ snipped ]

And this is all for my code. So far I can do the basic of
getting this started; however, I can not seem to find a
way or an example of how to set the Internet Explorer
Document object to a local VBScript object so I can
manipulate elements (text boxes on the form) through use
of their IDs and VALUE property.

Has anyone done something like this or know of a source
where I can get information or examples of how this is
done???

My goal is to automate filling out various common work
orders that get submitted on my company's local intranet
through a web page. The only form fiels that really
changes with my common work orders is the description,
room number, and location for each work order. I figure I
can place the commands to create each common (monthly)
work order in VBS files and execute them as needed.



Wed, 10 Nov 2004 05:06:59 GMT  
 How To Fill In An HTML Form On A Web Page Using A Standalone .VBS Script
Steve,

I tried to use your example in VBScript, but it does not seem to submit.  I
get the error message

"Object doesn't support this method"

Adam


Quote:
> You access the web document through the browser's--wait for it--document
> property! You can manipulate objects on the page just like you can using
the
> document object in client-side scripts.

> Here a Q&D example the fills in a fictitious form and submits it:

> Const URL = "http://localhost/flintstones.html"
> With WScript.CreateObject("InternetExplorer.Application")
>   .Visible = True
>   .Navigate URL
>   Do Until .ReadyState = 4
>     WScript.Sleep 50    ' wait for page to load
>   Loop
>   With .document.forms("bedrock")
>     .fred.value = "text"      ' enter text into a textbox
>     .barney.selectedIndex = 2 ' select third option of a select
>     .wilma(1).checked = True  ' select second of a group of radio buttons
>     .betty(0).checked = True  ' check first
>     .betty(2).checked = True  '   and third of a group of checkboxes
>     .submit
>   End With
> End With

> WARNING: You'll probably want a more rigorous test for the page's loading.

> --
> Experience is that marvelous thing that enables you to recognize a mistake
when
> you make it again. -Franklin P. Jones

> =-=-=
> Steve
> -=-=-



> I have been trying to figure out how to create a VBS
> script that will allow me to launch Internet Explorer,
> open a specific web page, and fill-in a form on the web
> page.

> I have gotten as far as launching Internet Explorer and
> opening a specific web page with the following code:

> [ snipped ]

> And this is all for my code. So far I can do the basic of
> getting this started; however, I can not seem to find a
> way or an example of how to set the Internet Explorer
> Document object to a local VBScript object so I can
> manipulate elements (text boxes on the form) through use
> of their IDs and VALUE property.

> Has anyone done something like this or know of a source
> where I can get information or examples of how this is
> done???

> My goal is to automate filling out various common work
> orders that get submitted on my company's local intranet
> through a web page. The only form fiels that really
> changes with my common work orders is the description,
> room number, and location for each work order. I figure I
> can place the commands to create each common (monthly)
> work order in VBS files and execute them as needed.



Sat, 27 Nov 2004 03:09:47 GMT  
 How To Fill In An HTML Form On A Web Page Using A Standalone .VBS Script
Steve,

With the example try

With .document.form("bedrock")
    .item.fred.value = "text"
    .item.submit.clicked
end with

This will get the result I believe you are lokking for.

Robert

Quote:
>-----Original Message-----
>Steve,

>I tried to use your example in VBScript, but it does not
seem to submit.  I
>get the error message

>"Object doesn't support this method"

>Adam



>> You access the web document through the browser's--

wait for it--document
Quote:
>> property! You can manipulate objects on the page just
like you can using
>the
>> document object in client-side scripts.

>> Here a Q&D example the fills in a fictitious form and
submits it:

>> Const URL = "http://localhost/flintstones.html"
>> With WScript.CreateObject

("InternetExplorer.Application")
Quote:
>>   .Visible = True
>>   .Navigate URL
>>   Do Until .ReadyState = 4
>>     WScript.Sleep 50    ' wait for page to load
>>   Loop
>>   With .document.forms("bedrock")
>>     .fred.value = "text"      ' enter text into a
textbox
>>     .barney.selectedIndex = 2 ' select third option of
a select
>>     .wilma(1).checked = True  ' select second of a

group of radio buttons
Quote:
>>     .betty(0).checked = True  ' check first
>>     .betty(2).checked = True  '   and third of a group
of checkboxes
>>     .submit
>>   End With
>> End With

>> WARNING: You'll probably want a more rigorous test for
the page's loading.

>> --
>> Experience is that marvelous thing that enables you to
recognize a mistake
>when
>> you make it again. -Franklin P. Jones

>> =-=-=
>> Steve
>> -=-=-



>> I have been trying to figure out how to create a VBS
>> script that will allow me to launch Internet Explorer,
>> open a specific web page, and fill-in a form on the web
>> page.

>> I have gotten as far as launching Internet Explorer and
>> opening a specific web page with the following code:

>> [ snipped ]

>> And this is all for my code. So far I can do the basic
of
>> getting this started; however, I can not seem to find a
>> way or an example of how to set the Internet Explorer
>> Document object to a local VBScript object so I can
>> manipulate elements (text boxes on the form) through
use
>> of their IDs and VALUE property.

>> Has anyone done something like this or know of a source
>> where I can get information or examples of how this is
>> done???

>> My goal is to automate filling out various common work
>> orders that get submitted on my company's local
intranet
>> through a web page. The only form fiels that really
>> changes with my common work orders is the description,
>> room number, and location for each work order. I
figure I
>> can place the commands to create each common (monthly)
>> work order in VBS files and execute them as needed.

>.



Sun, 19 Dec 2004 03:45:47 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help with Turbo Pascal 7.0

2. What is standard?

3. How to fill in a second form on a web page

4. Multiple Forms on a Web Page using the same script

5. Free Turbo Pascal?

6. How Do I Script Tables and make page breaks form a html Page

7. Filling a form on a web page

8. Oracle, TStoredProcedure and Cursor/Table result

9. ReportSmith Help

10. pass a form from web page to web page

11. pass a form from web page to web page

12. Fill Web Forms using VB?

 

 
Powered by phpBB® Forum Software