Folks,
I’ve got this snippet in a script
-- Loop through each work number and identify the image numbers associated with it.
repeat with workIndex from 1 to workNumberCount
set workNumber to item workIndex of workNumberList
set imageNumberList to {} as list
--open irisDirectory & irisWSLinks with password irisPassword
getURL irisRemoteLocation & irisWSLinks
set irisWSLinksDB to (a reference to database irisWSLinks)
if (exists irisWSLinksDB) is false then
display dialog "There is a problem finding the " & irisWSLinks & " file. Click Cancel and resolve this, then run the script again."
return
end if
tell database irisWSLinks
set imageList to (ID of every record whose (cellValue of cell "Work No." = workNumber)) as list
set imageCount to count of imageList
if (imageCount > 0) then
set imageNumberList to {} as list
repeat with wsIndex from 1 to imageCount
try
set wslinkRecord to (a reference to record ID (item wsIndex of imageList as integer))
set imageNumber to cellValue of cell "Surrogate No." of wslinkRecord
set imageNumberList to imageNumberList & imageNumber as list
on error
my write_to_file((outputDirectory & outputStatisticsFilename), "WARNING: Work number " & workNumber & " has problems accessing its image numbers." & newLine, true)
end try
end repeat
else
my write_to_file((outputDirectory & outputStatisticsFilename), "WARNING: Work number " & workNumber & " does not have any associated images." & newLine, true)
end if
end tell
set imageCount to count of imageNumberList
if (imageCount > 0) then
tell database irisSurrogat
repeat with imageIndex from 1 to imageCount
display dialog "Processing image record " & imageIndex & " of " & imageCount & " for work record " & workIndex & " of " & workNumberCount buttons {"OK"} default button "OK" giving up after 1
set imgNum to item imageIndex of imageNumberList
set cell "Surrogate No." of request 1 to imgNum
find window 1
if ((cellValue of cell "Surrogate No." of current record) = imgNum) then
set imageNumber to cellValue of cell "Surrogate No." of current record
set imageType to cellValue of cell "Source::Image Type" of current record
set imageApproved to cellValue of cell "Approved" of current record
set digitalMedia to my getDigitalFile(imageNumber) as list
set imageDigitalFilename to item 1 of digitalMedia as text
set imageColor to cellValue of cell "Color" of current record as text
set imageViewType to cellValue of cell "View Type" of current record as list
set imageViewDescription to cellValue of cell "View Description" of current record as text
set imageViewDate to cellValue of cell "View Date" of current record as text
set imageSubjects to cellValue of cell "Subjects" of current record as list
set imageSubjectAuthority to my getSubjectAuthority(imageSubjects) as list
set imageSubjectSubtypes to cellValue of cell "Subject Subtypes" of current record as list
set imageSubtypeAuthority to my getSubjectAuthority(imageSubjectSubtypes) as list
set imagePID to cellValue of cell "PID" of current record as text
set imageSourceNumber to cellValue of cell "Source No." of current record
set imageProjectName to cellValue of cell "Project Name" of current record as text
set imageExportDate to cellValue of cell "Export Date" of current record
set imageMetadataString to imageNumber & fieldSeparator & imagePID & fieldSeparator & imageProjectName & fieldSeparator & imageDigitalFilename & fieldSeparator & imageColor & fieldSeparator & my joinby(imageViewType, valueSeparator) & fieldSeparator & imageViewDescription & fieldSeparator & imageViewDate & fieldSeparator & my joinby(imageSubjects, valueSeparator) & fieldSeparator & my joinby(imageSubjectAuthority, valueSeparator) & fieldSeparator & my joinby(imageSubjectSubtypes, valueSeparator) & fieldSeparator & my joinby(imageSubtypeAuthority, valueSeparator) & fieldSeparator & imageExportDate & fieldSeparator & imageSourceNumber as text
else
set imageApproved to "" as text
set imageType to "" as text
set imageDigitalFilename to "" as text
set imageSourceNumber to "" as text
set imageProjectName to "" as text
set imageMetadataString to "" as text
end if
-- Only export images that have been approved.
if (imageApproved ≠"") then
-- and only work with slide or digital image type records
if (imageType = "slide") or (imageType = "digital image") then
if (imageDigitalFilename ≠"") then
set sourceMetadataString to my getSourceInformation(imageSourceNumber) as text
-- Write out the image information with the current work data.
set metadataLine to workNumber & fieldSeparator & projectName & fieldSeparator & imageMetadataString & fieldSeparator & sourceMetadataString & newLine as text
my write_to_file((outputDirectory & outputFilename), metadataLine, true)
set exportedImageCount to exportedImageCount + 1
-- Mark the image record to indicate that it is being exported for GDMS.
set cellValue of cell "Export Date" of current record to exportDate
-- Determine if this image is a new one based on the project name
if (imageProjectName = projectName) then
set projectImageCount to projectImageCount + 1
end if
end if
end if
end if
end repeat
end tell
else
display dialog "Processing no image records for work record " & workIndex & " of " & workNumberCount buttons {"OK"} default button "OK" giving up after 1
end if
end repeat
When it runs, it always fails at the same line but not necessary the same record in the FileMaker db:
display dialog "Processing image record " & imageIndex & " of " & imageCount & " for work record " & workIndex & " of " & workNumberCount buttons {"OK"} default button "OK" giving up after 1
The error returned is “AppleEvent timed out.” I don’t understand why it times out since I have the display dialog command give up after 1 second. I’ve added the display dialog so that the user can see the progress of the data.
In addition, the entire tell application block of code is within a
with timeout of 600 seconds
statement.
I’m curious to know if anyone else has had issues with using display dialog in nested repeat loops.
Thanks,
Jack