Filemaker 10 get url put contents into field
Asked Answered
C

5

5

Im trying to get the contents of a webpage put into a field in Filemaker pro 10. Does anybody know the code to do this in the scripmaker?

I have a field called URL that has the url I want and a filed called content, this is where the source html will go once FMP has grabbed the web page.

Thanks for reading.

City answered 12/8, 2009 at 20:36 Comment(1)
I just experienced a vietnam-war-sized flashback. I think I have to go home early, turn off all the lights and curl up in a fetal ball.Wringer
D
7

Filemaker 10 is perfectly capable of exporting the web viewer contents for you.

Use the Object Viewer in layout mode to name your web viewer (I am using "YourWebViewerName" here) then you can snag the content of your webviewer using:

GetLayoutObjectAttribute("YourWebViewerObjectName";"Content")

Your scriptmaker step would look like:

Set Field [tablename::Content; GetLayoutObjectAttribute ("YourWebViewerObjectName"; "Content")]

Duplicator answered 26/8, 2009 at 17:47 Comment(2)
Indeed. The murky depths of FileMaker's layout functions!Surmount
Note: You'll want to pause your script until the web viewer is finished loading, and this doesn't work with binary data.Otiliaotina
S
2

But you can get a plugin like ScriptMaker from 360Works, which, among other things, lets you do this:

Get URL as Text: Retrieves the contents of a URL (url) as a text field.

Surmount answered 13/8, 2009 at 8:3 Comment(0)
V
1

Or…

You can of course loop until a time Start + x is up...

However delaying a "second or 2" for the wv to load is a gamble anyway... you don't know how long it will take on any given day or moment for the page to load.

So I would be inclined to wrap the Get Content step as described above in a loop with an exit test that looks to see that the entire HTML has been loaded (e.g. content retrieved should contain the string "</html>")... plus a time out check so that if it hasn't arrived within say 10 or 20 seconds you bail out and report some kind of error.

Volcanic answered 3/9, 2009 at 10:46 Comment(0)
C
0

I realize this is an old thread - but there is another, rather klunky but useful, way to do this as a one-liner... getting the escaping and paragraph markers etc right is finniky, but, worth it in some cases..

Perform AppleScript["set cmd to \"curl 'http://wherever.com/whichever.php?randomparameter=" & Database::Field & "'\"" & ¶ & "set someVariable to do shell script cmd" & ¶ & "set cell \"someField\" of current record to someVariable"]
Constitutional answered 25/7, 2013 at 19:6 Comment(0)
U
-1

You can eighter do it via a button that launches a script or you can just add a button in layout mode and then select use url and add the url between the "" marks to launch it.

Uird answered 19/9, 2020 at 7:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.