Force InDesign progress bar during PDF export?

It all depends on what is the content of your font_list

I found this discussion in which @blend3 mentions that if a script is saved as an application then below needs to change from

if font_list contains "not available" then

to:

if font_list contains "Ā«constant ****fsNAĀ»" then

Otherwise, the script doesnā€™t work, not sure why this is, but the script gets a different type of result from the script editor than it does from an application script!
Generate Missing fonts report in Indesign - #6 by blend3

After I made the change, the application kept ignoring the missing font block and creating the PDFs rather than displaying the dialog box and stopping. As far as you know, is there any solution to this?

good advice. regardless if youā€™re running a script or an app you should check for both ā€œnot availableā€ and ā€œĀ«constant ****fsNAĀ»ā€ - the result of string conversion of InDesign constants can be unpredictable.

also, I recommend to use ā€œdisplay alertā€ instead of ā€œdisplay dialogā€ when interacting with InDesign. i saw all kind of weird issues with ā€œdisplay dialogā€ being used with InDesign - from not displaying the dialog to other bugs. no issues with ā€œdisplay alertā€.

in addition, as @KniazidisR suggested, you must check the contents of your font_list array. only then youā€™ll know for sure whatā€™s going on.

The contents of the font_list variable is ā€œsubstitutedā€ and per your recommendation, I changed the dialogs to alerts. I donā€™t understand why it is a different result from the script vs. the application and how to fix it

image

set myfontprop to properties of every font
        			set font_list to {}
        			repeat with i from 1 to the number of myfontprop
        				set this_font_item to item i of myfontprop
        				set myfontname to name of this_font_item as string
        				set fontstatus to status of this_font_item as string
        				set font_list to font_list & fontstatus
        			end repeat
        			--if font_list contains "not available" then
        			if font_list contains "Ā«constant ****fsNAĀ»" then
        				my resetUserInteractionLevel()
        				--display dialog " Missing Font." buttons {"OK"} with icon 0 default button 1 cancel button 1 giving up after 300 --5min
        				display alert " Missing Font." buttons {"OK"} as warning default button 1 cancel button 1 giving up after 300 --5min
        			else if font_list contains "substituted" then
        				my resetUserInteractionLevel()
        				--display dialog "A Font has been substituted or it is missing." buttons {"OK"} with icon 0 default button 1 cancel button 1 giving up after 300 --5min
        				display alert "A Font has been substituted or it is missing." buttons {"OK"} as warning default button 1 cancel button 1 giving up after 300 --5min
        				end if

just check if the status isnā€™t installed. anything else isnā€™t good.

From previous posts, I understand that your font_list does not contain strings, but InDesign constants. Therefore, the check (comparison) should be done with constants, not strings. To do this, simply remove the quotes:
Ā 

if font_List contains not available then
	my resetUserInteractionLevel()
	display dialog " Missing Font." buttons {"OK"} with icon 0 default button 1 cancel button 1 giving up after 300 --5min
else if font_List contains substituted then
	my resetUserInteractionLevel()
	display dialog "A Font has been substituted or it is missing." buttons {"OK"} with icon 0 default button 1 cancel button 1 giving up after 300 --5min
end if

Ā 

For days, Iā€™ve been trying to figure this out. The script executes exactly as expected and produces no PDF if you export it as an application," open it in Script Debugger," and execute it from there with the quotes on the font_list block if statement. The display alert will appear and stop the PDF from being created. See the screengrab below.
However, if the quotes are removed from the font_list block if statement, a PDF is generated.

The other situation is that if you execute the application by double-clicking, whether or not the quotes are in the font_list block if statement, or replacing it with ā€œĀ«constant ****fsNAĀ»ā€ the PDF is still generated, which is not supposed to happen. What else can be tried so that the font_list block is not ignored by the application?

You confused me with your explanation that in some site you were offered to use ā€œā€œconstant ****fsNAā€ā€ and I thought that you were operating with constants, not strings. But in your script 44 you are building a font_list from strings.

The whole trick is that you can use constants in font_list and compare in the if block the constants, or you can use strings in the font_list and compare in the if block the strings. That is, the point is to compare the data of same type, and thatā€™s it. Because if you compare data of different type (A contains B), A will never contain B, the condition will never be met and your display dialog wonā€™t show up.

Here you have in post 44 an excessive repeat loop + an unnecessary conversion of a constant to a string (as string coercion). You can just not do all this, and operate with constants:
Ā 

set font_list to status of every font -- constants list

if font_List contains not available then -- constant comparsion 
	my resetUserInteractionLevel()
	display dialog " Missing Font." buttons {"OK"} with icon 0 default button 1 cancel button 1 giving up after 300 --5min
else if font_List contains substituted then
	my resetUserInteractionLevel()
	display dialog "A Font has been substituted or it is missing." buttons {"OK"} with icon 0 default button 1 cancel button 1 giving up after 300 --5min
end if

Ā 

1 Like

Thanks for your help. That worked