Thanks. I tried that, but got an error message "System Events got an error: Can't continue writeTo." number -1798.
The line writeTo(finalText, file5Path, false, string) was marked as the problem line. Any ideas? On Sun, Jan 31, 2010 at 12:34 PM, Lee Hoong <[email protected]> wrote: > Charlie, > > The problem is setting the correct context - you have to wrap lines 1 thru 14 > within a System Events tell block: > > Tell application "System Events" > > set file1Path to "Macintosh HD:Users:chartley:Desktop:academic web > files:review files:review begin part" > set file2Path to "Macintosh HD:Users:chartley:Desktop:academic web > files:review files:ssr_h1" > set file3Path to "Macintosh HD:Users:chartley:Desktop:academic web > files:review files:ssr" > set file4Path to "Macintosh HD:Users:chartley:Desktop:academic web > files:review files:review end part" > set file5Path to "Macintosh HD:Users:chartley:Desktop:academic web > files:review files:round 1:ssr.php" > > set file1Text to read file file1Path > set file2Text to read file file2Path > set file3Text to read file file3Path > set file4Text to read file file4Path > set finalText to file1Text & return & file2Text & return & file3Text & > return & file4Text > > writeTo(finalText, file5Path, false, string) > > end tell > > [...] > > Hope that helps. > > > Lee. > ================= > Binary Assist > 220 Gaines Oak Way > Suwanee, GA 30024 > Voice: (678) 313-5604 > Internet: [email protected] > Website: www.binaryassist.com > > FileMaker 10 Certified Developer > > > > On Jan 31, 2010, at 10:40 AM, Charles Hartley wrote: > >> I have an appleScript that works from the AppleScript Script Editor, >> but fails when I try to add it to a FMP script. Here it is: >> >> ----- >> set file1Path to "Macintosh HD:Users:chartley:Desktop:academic web >> files:review files:review begin part" >> set file2Path to "Macintosh HD:Users:chartley:Desktop:academic web >> files:review files:ssr_h1" >> set file3Path to "Macintosh HD:Users:chartley:Desktop:academic web >> files:review files:ssr" >> set file4Path to "Macintosh HD:Users:chartley:Desktop:academic web >> files:review files:review end part" >> set file5Path to "Macintosh HD:Users:chartley:Desktop:academic web >> files:review files:round 1:ssr.php" >> >> set file1Text to read file file1Path >> set file2Text to read file file2Path >> set file3Text to read file file3Path >> set file4Text to read file file4Path >> set finalText to file1Text & return & file2Text & return & file3Text & >> return & file4Text >> >> writeTo(finalText, file5Path, false, string) >> >> on writeTo(this_data, target_file, append_data, mode) -- append_data >> is true or false, mode is string etc. (no quotes around either) >> try >> set target_file to target_file as Unicode text >> if target_file does not contain ":" then set target_file to >> POSIX >> file target_file as Unicode text >> set the open_target_file to open for access file target_file >> with >> write permission >> if append_data is false then set eof of the open_target_file >> to 0 >> write this_data to the open_target_file starting at eof as mode >> close access the open_target_file >> return true >> on error >> try >> close access file open_target_file >> end try >> return false >> end try >> end writeTo >> ----- >> >> When I try to add it to a FMP script I get the following error >> message: "Expected end of line, etc. but found class name." and >> indicates that the error occurs at the word "file" on the line that >> reads, "set file1Text to read file file1Path." >> >> This occurs with the latest FMP as well as with my older v.6. >> >> Any ideas what the problem is? >> >> Thanks, >> Charlie >> > >
