Re: WScript & Sendkeys
- From: mr_unreliable <kindlyReplyToNewsgroup@xxxxxxxxxxx>
- Date: Sun, 01 May 2005 19:41:31 -0400
hi ken,
I'm confused. Did you mean vbSCRIPT or vb -- as in VISUAL BASIC.
If you meant visual basic, then you don't need the scripting versions of appactivate and sendkeys. VB has its own appactivate and sendkeys, (as well as a sleep api as mentioned above).
However, that being said, I suggest that there is a more effective way to go about "filling in a form". I suggest instantiating internet explorer, navigating to the html page with the form, hooking into the page's "document object model", and filling in the form by setting appropriate values into the input tag elements on the form.
You can find plenty of examples of this approach on the scripting ng's. Search the group archives for "InternetExplorer.Application".
cheers, jw
Ken Nelson wrote:
I need to write a program in VB that automatically goes out to a website and uses the SendKeys function to fill it in for me.
I have been researching WScript Shell & SendKeys and was given the following code snippit:
Private Sub Command1_Click() Set wshshell = CreateObject("Wscript.Shell") wshshell.Run "Notepad" wshshell.AppActivate ("notepad") wscript.sleep 500 wshshell.SendKeys "Hello, World!" End Sub
When I run it, I get "Object Required" on the "wscript.sleep 500" line. That is one problem, the second is I want to open up a web page in IE, not notepad, so wanted to change it to look something like:
Private Sub Command1_Click() strURL = "http://www.google.com" Set wshshell = CreateObject("Wscript.Shell") wshshell.Run (strURL) x=wshshell.AppActivate (strURL) wscript.sleep 500 wshshell.SendKeys "Hello, World!" End Sub
The .AppActivate is not working (x turns out to be false)...so what do I need in teh AppActivate instead of strURL?
I appreciate any help
Ken Nelson
.
- Prev by Date: FileStream, OutStream
- Next by Date: Re: Is it possible to change the local administrator password for multiple machines in a domain using WSH or VB Script?
- Previous by thread: Re: WScript & Sendkeys
- Next by thread: RE: WScript & Sendkeys
- Index(es):
Relevant Pages
|