Folks,
I’ve only been working with Applescript for two weeks (and FileMaker for about a month) and gotten some help from these forums. I’m at a point where I’m stuck. I’m reading from one FileMaker (which is working fine from the event log debugging) and trying to update records in another FileMaker database. Both files are opened as references. The loop I’m using looks like this:
repeat with i from 1 to 3
-- Get the Spiro values to use to populate the IRIS system
set spiroCurrentRecord to (a reference to record i of layout 0 of spiroSlideViewDB)
-- Go get an IRIS record and update it
set irisSurrogateRecordNumber to irisSurrogateStart + i - 1
set irisSurrogateRecord to (a reference to record (irisSurrogateRecordNumber) of layout 0 of irisSurrogateDB)
-- Map the data
set digitalFileName to cellValue of cell "imageID" of spiroCurrentRecord
set cell "View Description" of irisSurrogateRecord to cellValue of cell "viewDet" of spiroCurrentRecord as text
set cell "View Type" of irisSurrogateRecord to cellValue of cell "viewDesc" of spiroCurrentRecord as text
-- NOTE: picDate does not contain valid data
set cell "View Date" of irisSurrogateRecord to cellValue of cell "picDate" of spiroCurrentRecord as text
-- Format the color Spiro metadata to the required value in IRIS before setting the record value.
set imageColor to cellValue of cell "color" of spiroCurrentRecord
if (imageColor = "c") or (imageColor = "c ") then
set imageColor to "color"
else if (imageColor = "b") or (imageColor = "b ") then
set imageColor to "b/w"
else
set imageColor to ""
end if
set cell "Color" of irisSurrogateRecord to imageColor as text
-- Format the orientation Spiro metadata to the required value in IRIS before setting the record value.
set orientation to cellValue of cell "orient" of spiroCurrentRecord
if (orientation = "l") or (orientation = "l ") then
set orientation to "horizontal"
else if (orientation = "p") or (orientation = "p ") then
set orientation to "vertical"
else
set orientation to ""
end if
set cell "Orientation" of irisSurrogateRecord to orientation as text
--save irisSurrogateRecord
display dialog irisCollection & " record " & i & " (" & digitalFileName & ") has updated Surrogate record " & irisSurrogateRecordNumber & "."
end repeat
I’ve tried doing the set statements as “set cell” and “set cellValue of cell”. Neither works. I tried using the commented out “save …Record” thinking I needed to do that. I don’t get any error, I just don’t see the new values appearing in the records. Can anyone tell me what I’m doing wrong?
Maybe it is FileMaker related?
The FileMaker things to mention are that the database I’m writing to was purchased. It requires a password when opening it. Does anyone know if FileMaker would require a password to update records via AppleScript? I tried adding a “with password …” to the set statements or save statement but I get a syntax error.
Also does FileMaker allow you to disable updating records via AppleScript calls to the application? I’m wondering if that’s why the records aren’t updating (if the syntax above is correct).
Thanks,
Jack