• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 965
  • Last Modified:

Foxpro command to manipulate a web form

I need to have an set of commands that will open up, but not if it is already open, a web page and fill in a text box and submit the form. I am not necessarily wanting to program it as it is in a foxpro app I have that lets me do commands in the app itself. But if programming in if Foxpro I can do that too.
0
Joe Pelish
Asked:
Joe Pelish
  • 4
  • 3
  • 2
2 Solutions
 
Olaf DoschkeSoftware DeveloperCommented:
You can only automate a browser with OLE interface, that is IE as InternetExplorer.Application. The other thing you can influence of course, is a webbrowser control within your form.

You can access the DOM and therefore can set values in html forms etc and submit forms, that's doable. But mainly only with IE. I never tried to use the firefox activex project to get ole automation work with it, but you may try that: http://www.adamlock.com/mozilla/

Forget about doing whatever you want to do with any browser, though. Each one has it's different ways. Plugins like flash or evernote are really programmed for each browser to be available in any one. Of course the core functionality of whatever plugin you want to write can be shared, but the plugin models are differing and you rather need dotnet or c/c++ to do it.

Bye, Olaf.
0
 
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
You have to turn off Protection Mode in IE for this to work

PUBLIC oIE AS InternetExplorer.Application
cHTML = '<html><body><input type="text" id="name" size="25" /></body></html>'
= STRTOFILE(cHTML, 'fillform.htm')
oIE = CREATEOBJECT("InternetExplorer.Application")
oIE.Visible = .T.
oIE.Navigate(ADDBS(SYS(5)+SYS(2003))+'fillform.htm')
WAIT TIMEOUT 2
WITH oIE.Document
      oTextBox = .getElementById("name")
      oTextBox.value = 'Cyril'
ENDWITH
0
 
Joe PelishIT Manager/Systems AdministratorAuthor Commented:
CaptainCyril,
I was needing something like opening superpages.com and putting in a phone number and submitting. Right now I always create a new browser window instead of using the same one over and over again. Please advise. Thanks!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
You can check oIE.If it is still accessible then use it otherwise forget it.
IF TYPE('oIE') <> 'U'
    oIE.document....
ENDIF

If it's a webbrowser window inside FoxPro, then you can always access it:
oForm.webbrowsercontrol.Document...
0
 
Olaf DoschkeSoftware DeveloperCommented:
>Right now I always create a new browser window instead of using the same one over and over again.

If that`s the main problem. Once you have a reference to a browser like oIE in Cyrils code, this can be used multiple times. What stops you from doing that?

After the code is before the code. Simply do a loop and restart at oIE.navigate to start with the empty form you put in a phone number.

And as I often state at such web automation tasks, not everything is legal.
See http://www.superpages.com/about/copyright.html

Data Mining Prohibited

You may not use bots or similar methods or tools to "data mine" or otherwise gather or extract data from This Website, without SuperMedia's prior consent, which consent may be withdrawn by SuperMedia at any time, with or without notice, in SuperMedia's sole discretion.

Bye, Olaf.
0
 
Joe PelishIT Manager/Systems AdministratorAuthor Commented:
Olaf,
I am just trying to automate a address lookup for my company so we can see why our address correction software says it is undelieverable it is not for commerical use or anything.
0
 
Olaf DoschkeSoftware DeveloperCommented:
That's not what matters, the prohibition is not making a difference on your usage of the data.

Google "superpages API" and you'll find legal ways of programmatic requests via theri web services.

If you already have an address correction software, then why test it with yellow pages at all? You trust what you get for free (at least for low amounts of queries) more than what you pay for?

Bye, Olaf.
0
 
Joe PelishIT Manager/Systems AdministratorAuthor Commented:
No, I am using a phone number for the person to see what needs to be corrected. Thanks for info.
0
 
Olaf DoschkeSoftware DeveloperCommented:
"I am using a phone number for the person to see what needs to be corrected"

"I am just trying to automate a address lookup so we can see why our address correction software says it is undelieverable"

You made yourself fully clear.

Still:

1. The data mining prohibition has an exception: "without SuperMedia's prior consent". So why not ask them? They might do your work for a reasonable fee

2. If your commerical (i assume) address verification software fails with your data the question is, why not update it or it's data, it should be updatable as a software or in it's data to be able to correct your addresses, shouldn't it?

That's my two points. I won't discuss legal stuff in the fabric of history, justice, fairness, insignifacance or whatever else is involved here. I quoted their prohibition. It's their data, they can decide how many request they allow and if they forbid bots. And what you're doing is a bot, even if you limit yourself to check your data and only want to get it updated for your company and even if it's in the interest of your customers to get something delivered, like subscribed magazines or whatever.

Bye, Olaf.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now