This is a script I used in OS9 Filemaker to write external text text files with unique info and filename…now it doesn’t work in OSX.
Here is the script:
[color=blue]
tell application “FileMaker Pro”
set this_name to get data cell “HTML File Name” of the current record
set this_data to get data cell “HTML Page” of the current record
end tell
tell application “Finder”
set this_file to (((path to desktop folder) as text) & “jewelry_HTML:” & this_name)
set the target_file to the this_file as text
set the open_target_file to open for access file target_file with write permission
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
try
close access file target_file
on error
end try
end tell
[/color]
Maybe the OS X Finder is fouling things up. Does this work?
tell application "FileMaker Pro"
set this_name to get data cell "HTML File Name" of the current record
set this_data to get data cell "HTML Page" of the current record
end tell
set this_file to (((path to desktop folder) as text) & "jewelry_HTML:" & this_name)
set the target_file to the this_file as text
set the open_target_file to open for access file target_file with write permission
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
try
close access file target_file
end try
Do you get a valid path when you run this much of the script?
tell application "FileMaker Pro"
set this_name to get data cell "HTML File Name" of the current record
set this_data to get data cell "HTML Page" of the current record
end tell
set this_file to (((path to desktop folder) as text) & "jewelry_HTML:" & this_name)
set the target_file to the this_file as text
target_file
Do you have any idea of where it is failing? i.e. how far it gets, and which line is causing the problem?
The only thing in the script that looks strange to me is the line:
write this_data to the open_target_file starting at eof
I don’t think ‘eof’ is defined in your script. The Mac OS X standard additions imply that you should:
set theEOF to get eof open_target_file -- get the current EOF
write this_data to the open_target_file starting at theEOF
In other words, I don’t see where your current script is working out where to start writing data. The additional line in my version explicitly gets the current EOF.