I got the AppleScript progress bar working in a test script. Then, I tried copying and pasting it into the larger script and the progress bar didn’t show up anymore. I narrowed the problem down to some Objective C code that had to be added to the larger script. The larger script makes a pdf of every InDesign file, then attempts to combine all those pdfs into one pdf book. Because of an alias bit bug, the pdfs would be combined into two books, so I need the objective c code in to fix that bug.
Is there a way to change the code to get the objective c and the AppleScript progress bar to cooperate together? Thanks!
------------------------------------------------------------------------------------------------------------------------------
--FIXING THE ALIAS BIT BUG THAT PREVENTS THE SCRIPT FROM COMBINING ALL INDESIGN FILES INTO ONE PDF
------------------------------------------------------------------------------------------------------------------------------
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
property filesToOpen : {}
on open droppedfiles
set my filesToOpen to my filesToOpen & droppedfiles
-- cancel any pending performSelector: requests
current application's NSObject's cancelPreviousPerformRequestsWithTarget:me
-- handle files after a short delay in case further events are received
tell me to performSelector:"doOpen" withObject:(missing value) afterDelay:0.5
end open
on doOpen()
copy my filesToOpen to droppedfiles
set my filesToOpen to {} -- reset for next time
set aRes to length of droppedfiles
repeat with i in droppedfiles
set j to POSIX path of i
end repeat
------------------------------------------------------------------------------------------------------------------------------
--DISPLAYING THE PROGRESS BAR
------------------------------------------------------------------------------------------------------------------------------
repeat with i from 1 to count of droppedfiles
set afile to item i of droppedfiles
set item_count to count of droppedfiles
set prog_description to "Duplicating File " & i & " of " & item_count
tell current application to activate
my make_progress_bar(afile, item_count, i, prog_description)
end repeat
end doOpen
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
--FUNCTIONS
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
--Function to create progress bar
on make_progress_bar(this_item, item_count, current_item_count, prog_description)
set progress total steps to item_count
set progress description to prog_description
tell application "Finder" to set item_name to name of this_item
set progress additional description to item_name
delay 1
set progress completed steps to current_item_count
end make_progress_bar
Browser: Safari 604.3.5
Operating System: macOS 10.14