Terrible Toll Posted June 6, 2008 Posted June 6, 2008 I have another little conundrum involving transferring data from one file to another. This time I need to lift the contents of a text file into a single field in FileMaker . . .a seemingly trivial task that is very easily performed manually. I wrote the script enclosed for this which works well until TextEdit hits it's memory ceiling. What I want to know is, is there any way I can lift the text straight out of the file without going via TextEdit, or is there another way round this problem. The text files are large (~250,000 lines), so the other methods of importing into FileMaker have proven too cumbersome and I need to be able to import the text before I can break it up into useable elements. As usual, it is trying to get FileMaker to do something for which it was not really intended. thanks in advance for any hints, scorn or queries Anatole -- request the file containing the text set filePath to POSIX path of (choose file with prompt "Select text file for import" without invisibles) -- get the text of file and put it in current FileMaker record tell application "TextEdit" open POSIX file filePath as alias set docCopy to text of document 1 close document 1 end tell try tell application "FileMaker Pro Advanced" tell table "_PostScript_settings" set contents of cell "textfile" to filePath as text set contents of cell "fulltext" to docCopy end tell end tell end try
Terrible Toll Posted June 6, 2008 Author Posted June 6, 2008 OK - another step forward The following code works from Script Editor, but won't work from FileMaker. I presume I need to put the open and set lines within a try using application "XX". I have tried Finder and System Events, but then it doesn't read the POSIX file. -- request the file containing the text set filePath to POSIX path of (choose file with prompt "Select text file for import" without invisibles) -- get the text of file and put it in current FileMaker record open for access file filePath set docCopy to read POSIX file filePath as text try tell application "FileMaker Pro Advanced" tell table "_PostScript_settings" set contents of cell "textfile" to filePath as text set contents of cell "fulltext" to docCopy end tell end tell end try
Recommended Posts
This topic is 6013 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