Applescript works fine in ScriptEditor but not in Filemaker Pro
I'm getting an odd result from an Applescript script being called from within Filemaker that I've not seen before nor have I found a reference to it online here or elsewhere.
The following script creates three new records and makes a call to the Filemaker script "paste_into_container". The FM script "paste_into_container is very simple, it pastes whatever is currently on the clipboard into a specific container field. When the script is called from within Filemaker, the "paste_into"container" subscript will only paste the contents of the clipboard into the last new record. The container field on the first two records is left blank.
It's almost as if the loop creates the new record, ignores the "go to last record and "paste_into_container" lines in the script, and then moves on to the next iteration of the loop.
The script works fine when called from ScriptEditor but fails when called from within Filemaker. The script will also work if I drop the repeat loop and create just one record.
I've tried increasing the delay added at the end of each loop but it does not make any difference whether it is 1 or 15 seconds.
I'm sure it's something simple but I'm not seeing it and after two days it's time for help (of one kind or another)
additional info:
Mac OS 10.6.8
Filmaker Pro 11 running with Filemaker Server 11
Thanks in advance
Phil
tell application "FileMaker Pro"
show every record in table "Image_Info" in database myDB
go to layout 1 of database myDB
repeat with i from 1 to 3
set myNewRecord to create new record in database myDB
go to last record
do script "paste_into_container"
delay 1
end repeat
end tell
Intel iMac7, Mac OS X (10.5.8)