Jump to content
Server Maintenance This Week. ×

Issues With Scraping A Web Page


Lyinggod

This topic is 4889 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am using FM 10 on a windows system.

I am having an issue with dealing with "real" web page code in a web viewer after the user clicks on a link. This is the process

1) User presses scripted button to load web page from www.somesite.com/page1.htm into viewer

2) Layout changes and script processes web page and reloads it into same viewer using only local variables

3) User clicks on a link that is contained within the processed (from step 2) web page.

4) Web page loads into viewer from www.somesite.com/page2.html

5) User clicks different FM scripted button to process page (same script as step 2)

6) The variable that contains GetLayoutObjectAttribute("viewer";"content") for processing the newly load page only returns the contents of the html code that the viewer had at the end of step 2 instead of the new page that was loaded in step 4.

I have tried refreshing the page, moving to a different record and then back without any success, and using GOTO OBJECT (viewer) to try to capture the new page code without success.

If I right click on the web viewer, and choose VIEW SOURCE CODE, I see the HTML code for the current page, however I just cant get FM to grab that code.

I am hoping that someone might have some thoughts on the matter.

Thank you for your attention.

Link to comment
Share on other sites

I have found a somewhat clunky way around this issue. I right click on a link that leads to the desired web page within the web viewer and SAVE SHORTCUT or I can hold CTRL & ALT and drag the link (or paste) into a global field that has a scripted button. Then reloads the web viewer based on the value of the global field.

Has anyone perhaps come up with a less clunky solution?

Thanks for your attention.

Link to comment
Share on other sites

I've recently been experimenting with attaching to the COM object corresponding to the WebViewer, since under Winblows, it's just an embedded Internet Explorer browser.

Using the free scripting program autoit, Autoit you can attach to the WebViewer.

You can write a script along the lines of the attached file, that will retrieve the HTML in the current WebViewer, and save it to a file. You can then import it back as a workaround to this bug. FMPro then executes the autoit script.

A more interesting and useful application of this technique is to allow interaction with the WebViewer. i.e. Filemaker can dynamically generate and execute an autoit script to click buttons, complete forms, etc, in the WebViewer. An example of this is also in the attached file.

You can easily have autoit select all, and copy the text in a WebViewer to clipboard. It can insert a JavaScript into the head of a document after it has loaded. Once you have the handle on the COM object, _ieaction can be used to print the webviewer via FM Script which triggers autoit script.

autoit can back call FM Scripts from ActiveX to handle returning, or use its simple TcpRecv example, as a template to trigger an FM Script over the internet, and achieve in a few lines of code, the equivalent to commercial plugins. It's an interesting alternative to VBScripts with some more functionality and GUI capabilities.

I have found a somewhat clunky way around this issue. I right click on a link that leads to the desired web page within the web viewer and SAVE SHORTCUT or I can hold CTRL & ALT and drag the link (or paste) into a global field that has a scripted button. Then reloads the web viewer based on the value of the global field.

Has anyone perhaps come up with a less clunky solution?

Thanks for your attention.

Test222.zip

Link to comment
Share on other sites

This topic is 4889 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.