Heathbo Posted February 6, 2006 Posted February 6, 2006 Sorry, I wasn't sure were this question would go. My question is, is it possible to download data from a general website and input the data into FileMaker? Is there a script that will do this or a utility?
Søren Dyhr Posted February 6, 2006 Posted February 6, 2006 Take a look here: http://jesse.cnsplug-ins.com/index.htm?category=AppleScript But beware that a lot of switches could be needed to cope with sites out of the ordinary html. http://curl.haxx.se/docs/httpscripting.html --sd
Heathbo Posted February 8, 2006 Author Posted February 8, 2006 Thanks Soren. Now, do you know a way of taking text that is imported into a container, searching for keywords in the text, finding the text associated with those keywords and then copying and pasting in separate text fields? I hope this isn't too hard to do. It would make my life much easier. Thanks
Søren Dyhr Posted February 8, 2006 Posted February 8, 2006 Why do you import to a containerfield ...should be text! --sd
Wim Decorte Posted February 8, 2006 Posted February 8, 2006 A couple of ways of doing this. Look at the Patterncount and Position functions.
Søren Dyhr Posted February 8, 2006 Posted February 8, 2006 Indeed provided the recieveing field is text, but an alternative could be piping further through a combination of sed and grep under shell scripting, would make the hit on storage less ...but also tougher to figure out. --sd
Heathbo Posted February 10, 2006 Author Posted February 10, 2006 It seems though that Curl doesn't do everything. I've tried it on a few websites and comparing what Curl brings back to what is shown when you View Source in your internet browser. It seems Curl doesn't show all the html. Any other ideas on how to download a sites html into a text field in filemaker.
Heathbo Posted February 10, 2006 Author Posted February 10, 2006 My next step was to try to use Applescript in FileMaker to control safari to copy the source html of the front most page. Here is the code I used. tell application "Safari" activate set frontmost to true set theURL to URL of front document set theTitle to name of front window set theSource to source of front document set the clipboard to theSource as Unicode text end tell The problem now is, Filemaker doesn't seem to see that there is text in the clipboard. I can paste it into TextEdit but not into FileMaker. Although the weird thing is, after pasting it into TextEdit I can select all and then copy that and FileMaker then sees text in the clipboard. I'm stumped.
Fenton Posted February 10, 2006 Posted February 10, 2006 If you just want the text, you don't need to use the clipboard. tell application "Safari" set theName to name of document 1 set theURL to URL of document 1 set theText to text of document 1 end tell You can then set theText (and others) into Filemaker fields (global for theText likely), then take it apart, ie.: tell application "FileMaker Pro Advanced" -- line not needed in a Perform Applescript step set cell "_gText" of current record to theText end tell -- ditto
Heathbo Posted February 10, 2006 Author Posted February 10, 2006 Fenton your a genius. All I had to do is make one simple change to your script and it works perfectly. This is what I did. tell application "Safari" set theName to name of document 1 set theURL to URL of document 1 set theText to source of document 1 end tell tell application "FileMaker Pro Advanced" Perform Applescript step set cell "Web content" of current record to theText end tell By changing the word text to source it now gives me the html code that I needed. This works better than what I was originally thinking. Thanks again.
Heathbo Posted February 10, 2006 Author Posted February 10, 2006 Now that I have the html in a text field I need to sort through it. What would be the best way of doing this? For example: In the following html I need to find the tag "Name:" first because that will always be there. Then I need to input the associated information "Jeremy Big" into a another text field. Name: Jeremy Big My questions are: What script would I need in FileMaker to find the Name: in the text field. Then how would I select "Jeremy Big" and copy and paste it into another text field named "Name". The reason I need to do a find first of Name: is that the associated data "Jeremy Big" will change.
Recommended Posts
This topic is 6861 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 accountSign in
Already have an account? Sign in here.
Sign In Now