Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enter data in web browser 1

Status
Not open for further replies.

wlhbill

Programmer
Aug 25, 2002
20
0
0
US
I have created a form using the _webform object from the _webview.vcx library. I can navigate to the web site ( problem. My problem is how to get my usps tracking number onto the form programatically. I've tried the keyboard() function to stuff the keyboard buffer but I haven't been able to give the data input field focus.
 
PURISTS AVERT YOUR GAZE!

Nobody seems to be helping with this one so if you're not
too fussy here is a bodge that might do it. I did this originally for a form in IE5 but I THINK(?) the principle is the same.

1. Store a known text string to the clipboard
_CLIPTEXT='NotThereYet'

2. Now send TAB keys to tab into your web page. The first control will be focused.

3. Send the key Control+C which copies to the clipboard. If the control is not a textbox no text is copied to the clipboard. You can test this by seeing if
_CLIPTEXT is still 'NotThereYet'

4. Keep sending tabs and Control+C until _CLIPTEXT returns empty. A textbox on the form now has focus. (Assuning the one you want is the first textbox in the tab order. If not tab to the next control and start again).

5. Store you number to the clipboard
_CLIPTEXT = 'cMynumber'

6. Copy it into the textbox by sending Control+V.


 
At this point I'm willing to try anything that will make it work. Thanks for your reply. I will post the results.

Bill
 
This seems to work:

A simple form with a web browser control in it called WEB

1. In the form init put:
********
this.web.navigate('*********
2. In the form activate put:
***********
thisform.web.setfocus
***********
3.In the web.CocumentComplete Event put:
***********
*** ActiveX Control Event ***
LPARAMETERS pdisp, url

oShell=CREATEOBJECT('WScript.Shell')
= oShell.SendKeys('{TAB 23}')
release oshell
******************

**the first two lines come with the object just leave them**
**it MUST be curly braces around TAB**

This tabs 23 times and gets you to your field. I'd rather check it as I said in my first post.

Good luck

John
 
John,
Thank you for the help. Your second post was the key I needed. The application now works with a single button click which was my goal.

I modified the DocumentComplete event as follows:
*** ActiveX Control Event ***
LPARAMETERS pdisp, url

LOCAL oShell

IF thisform.lPass
thisform.lPass=.F.
oShell=CREATEOBJECT('WScript.Shell')
=oShell.SendKeys('{TAB 23}')
=oShell.SendKeys(THISFORM.ctrack)
=oShell.SendKeys('{ENTER}')
RELEASE oShell
ENDIF

***

I added the logical lPass so this would only get executed the first time through.

Works like a charm, again Thank you,
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top