I’m noticing something weird in several of my scripts. If I have a display dialog before the first repeat loop, the script will display that dialog multiple times even though it should only display the dialog once. I put a test to see how many files were actually in the dropped file count. Instead of displaying six, like it should have, the script displayed “1”. Then it popped up a second dialog counting “5” dropped files. Any ideas on how to fix this would be greatly appreciated!
on open droppedfiles
--Testing how many items were dropped on the script
display dialog "Hey! you dropped " & (droppedfiles's length) & " item(s) on me!" --> Should return 6. Instead returns 1, then returns 5
--Prompting the user to name the combined pdf file
display dialog "Type the name of the combined pdf (don't type in the '.pdf'): " default answer "Example: 4th of July Spec Ad"
set the_name to text returned of the result
--Suppressing interrupting dialogs in InDesign
tell application "Adobe InDesign CC 2017"
activate
set user interaction level of script preferences to never interact
--Exporting a pdf
repeat with afile in droppedfiles
tell application "Adobe InDesign CC 2017"
open afile
tell active document
export format PDF type to ("Users:mbornbach:Desktop:Desktop Process:Test Scripts:PDFs:" & the_name & ".pdf" as string) without showing options
end tell
close active document saving no
end tell
end repeat
end open