So I’m doing this (in part):
Tell application "Filemaker Pro"
try
delete every request
end try
create request
set cell "IDnumber" to IDNumber
--The variable IDnumber is set earlier in the script
find
set r_count to count of records
set I to 1
do script "first_record"
repeat while I is less than or equal to r_count
set cell "Photo" of current record to file img_path
--The variable img_path is set earlier in the script
do script "next_record"
set I to I + 1
end repeat
--Note: The FMP scripts first_record and next_record each contain only "go to record/request/page []" (first and next respectively)
So first off, is there a better way to step through items in a found set than the way I’m doing it? I tried using
set cell "Photo" of record I to img_path
but that uses the record number for the whole DB not just the found sub-set.
And second, and perhaps more importantly, why does this work if I run it from Script Editor but does not work from inside FMP?
For example, if the Find returns 3 record, it will set the picture for the first of the three, but not the other two. Setting some debug, it does loop the three times but something clearly goes kerflooey when run inside FMP. In Script Editor it correctly sets each record in the found set to the picture in question.
This is majorly frustrating to say the least.
Thanks!!
PS: This is with Filemaker Pro 8 under Tiger (10.4.7) on an Intel iMac