I have an odd issue that is occurring while using InDesign CC 2015, yet it never happened in my scripts using InDesign CS4. The SystemUIServer default buttons are not always displaying as being highlighted. But sometimes they are. I tried including some delays, but I seriously doubt that is the reason, and who wants delays anyway. Can anybody shed some light as to why the default buttons are behaving this way. And it is hit or miss, sometimes they do display highlighted, sometimes they don’t?
Thanks,
-Jeff
This is my complete code:
global myStop, blacksFound, regsFound
on missingFonts()
tell application id "com.adobe.InDesign"
activate
tell document 1
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" or font_list contains "substituted" then
tell application "SystemUIServer"
activate
delay 0.5
set userResponseMissing to display dialog "This document contains one or more missing fonts or not fonts at all." & return & return & "Please fix the font issue and then run this script again." buttons {"OK", "Cancel Script And Fix Font(s)"} default button "Cancel Script And Fix Font(s)" with icon stop
if button returned of userResponseMissing contains "Cancel Script And Fix Font(s)" then
set myStop to true
return
end if
end tell
end if
end tell
end tell
end missingFonts
on myDPI()
tell application id "com.adobe.InDesign"
set myDoc to document 1
activate
tell myDoc
set theLink to every link
set theLink to every link
repeat with x from 1 to count of theLink
try
if link x's parent's effective ppi's item 1 < 300 and link x's parent's effective ppi's item 2 < 300 then
set theName to name of link x as string
tell application "SystemUIServer"
activate
delay 0.7
set userResponseDPICaught to display dialog theName & " is low resolution" & return & return & "Rembember that images without text must have an effective resolution of at least 300 DPI." & return & return & "If the image contains text then it must contain an effective resoltion of at least 600 DPI." & return & return & "NOTE: This script is only testing for images below 300 DPI" buttons {"OK, leave as-is", "Stop And Fix"} default button "Stop And Fix" with icon stop
if button returned of userResponseDPICaught contains "Stop" then
set myStop to true
return
end if
end tell
end if
end try
end repeat
end tell
end tell
end myDPI
on mySpots()
tell application id "com.adobe.InDesign"
activate
set myDoc to document 1
tell myDoc
--delete unused swatches
set allSwatches to every swatch
set swatchCount to count of allSwatches
repeat with i from 1 to swatchCount
set thisSwatch to item i of allSwatches
try
if name of thisSwatch is not "None" and space of thisSwatch is not CMYK then
set model of thisSwatch to process
set space of thisSwatch to CMYK
end if
end try
end repeat
end tell
end tell
end mySpots
on RGBCheck()
set myRGBCaught to "NO"
set RGBList to {}
set RGBCount to 0
tell application id "com.adobe.InDesign"
activate
set myDoc to active document
tell myDoc
repeat with docLinks from (count every link of myDoc) to 1 by -1
set myLink to link docLinks of myDoc
try
set mySpace to space of parent of myLink
if mySpace is "RGB" then
set myTestName to name of myLink
set myRGBFile to myTestName
set end of RGBList to myRGBFile & return
end if
end try
end repeat
set the RGBCount to count of items in RGBList
if RGBCount is equal to 1 then
tell application "SystemUIServer"
activate
delay 0.5
set userResponseRGBCaught to display dialog "The following RGB placed image was found:" & return & return & RGBList & return & "Fix the image so it is saved as CMYK and replace accordingly." buttons {"OK, leave as-is", "Stop And Fix"} default button "Stop And Fix" with icon stop
if button returned of userResponseRGBCaught contains "Stop" then
set myStop to true
return
end if
end tell
else if RGBCount is greater than 1 then
tell application "SystemUIServer"
activate
delay 0.5
set userResponseRGBCaught to display dialog "The following RGB placed images were found:" & return & return & RGBList & return & "Fix the image so it is saved as CMYK and replace accordingly." buttons {"OK, leave as-is", "Stop And Fix"} default button "Stop And Fix" with icon stop
if button returned of userResponseRGBCaught contains "Stop" then
set myStop to true
return
end if
end tell
end if
end tell
end tell
end RGBCheck
on myPasteboard()
tell application id "com.adobe.InDesign"
activate
tell document 1
repeat with i from 1 to (count of spreads)
tell spread i
try
set myPageItemsCount to count (every page item whose id of parent page is greater than 1)
set myAllItemsCount to count of (every page item)
set myPasteboardItems to myAllItemsCount - myPageItemsCount
end try
end tell
end repeat
try
if myPasteboardItems contains 1 then
tell application "SystemUIServer"
activate
delay 0.5
set userResponse to display dialog "There was " & myPasteboardItems & " item found on the pasteboard. Make sure this item does not belong with this document. If it is not needed then it should be deleted." buttons {"OK, leave item on pasteboard", "Stop And Fix"} default button "Stop And Fix" with icon stop
if button returned of userResponse contains "Stop And Fix" then
set myStop to true
return
end if
end tell
end if
if myPasteboardItems is greater than or equal to 2 then
tell application "SystemUIServer"
activate
delay 0.5
set userResponse to display dialog "There were " & myPasteboardItems & " items found on the pasteboard. Make sure these items do not belong with this document. If they are not needed then they should be deleted." buttons {"OK, leave items on pasteboard", "Stop And Fix"} default button "Stop And Fix" with icon stop
if button returned of userResponse contains "Stop And Fix" then
set myStop to true
end if
end tell
end if
end try
end tell
end tell
end myPasteboard
on oversets()
set theCount to 0
tell application id "com.adobe.InDesign"
activate
tell active document
set myAllPageItems to all page items of page 1
set x to count of myAllPageItems
repeat with x from 1 to x
set y to item x of myAllPageItems
if class of y is text frame then
if overflows of y is true then
set theCount to theCount + 1
end if
end if
end repeat
repeat with x from 1 to x
set y to item x of myAllPageItems
if class of y is text frame then
if overflows of y is true and theCount is greater than or equal to 2 then
select y
tell application "SystemUIServer"
activate
delay 0.5
set userResponseOversets to display dialog "The selected text frame is overset." & return & return & "Also found." & return & theCount & " additional overset frame(s) besides this one." buttons {"Fix Later", "Stop And Fix Now"} default button "Stop And Fix Now" with icon stop
end tell
if button returned of userResponseOversets contains "Stop And Fix Now" then
set myStop to true
end if
end if
if overflows of y is true and theCount is equal to 1 then
select y
tell application "SystemUIServer"
activate
delay 0.5
set userResponseOversets to display dialog "The selected text frame is overset." buttons {"Fix Later", "Stop And Fix Now"} default button "Stop And Fix Now" with icon stop
end tell
if button returned of userResponseOversets contains "Stop And Fix Now" then
set myStop to true
end if
end if
end if
end repeat
end tell
end tell
end oversets
on colorSpace()
--change all registration text to black
tell application id "com.adobe.InDesign"
activate
tell document 1
try
set findSwatch to swatch "Registration"
set myCount to count (every character of every story whose fill color is findSwatch)
--display dialog myCount as string
set properties of (every character of every story whose fill color is findSwatch) to {fill color:swatch "Black"}
end try
end tell
end tell
tell application id "com.adobe.InDesign"
set myDoc to document 1
activate
set myStop to false
set blacksFound to false
set regsFound to false
try
tell myDoc
try
set properties of every color of every item to {space:CMYK, model:process}
end try
end tell
end try
set allPageItems to object reference of all page items of myDoc
repeat with i from 1 to count of items in allPageItems
try
set theClass to class of item i of allPageItems as string
set theClass to theClass as string
--display dialog theClass as string
on error
exit repeat
end try
if theClass is "rectangle" or theClass is "text field" or theClass is "text frame" or theClass is "polygon" or theClass contains "cpgn" or theClass contains "txtf" or theClass contains "crec" or theClass contains "govl" then
try
set y to fill color of item 1 of item i of allPageItems
set theTint to properties of y
set theProps to color value of y as string
--display dialog theProps as string
set x to fill tint of item i of allPageItems as string
--display dialog x as string
if theProps contains "0.00.00.0100.0" and x contains "-1.0" then
set blacksFound to true
end if
if theProps contains "100.0100.0100.0100.0" and x contains "-1.0" then
set regsFound to true
end if
end try
-- Checking for registration strokes
try
set y to stroke color of item 1 of item i of allPageItems
set theTint to properties of y
set theProps to color value of y as string
--display dialog theProps as string
set x to stroke tint of item i of allPageItems as string
--display dialog x as string
if theProps contains "100.0100.0100.0100.0" and x contains "-1.0" then
set regsFound to true
end if
end try
end if
end repeat
if blacksFound is true then
tell application "SystemUIServer"
activate
delay 0.5
set userResponse to display dialog " !!! W A R N I N G !!!" & return & return & "Found some black filled objects set to 100% Black." & return & return & "Objects set to 100% Black will overprint." & return & return & "This can result in a printing issue depending upon the stacking order and what objects these black areas overlap." & return & return & "It is best you change the Black swatch's tint to 99% or use a built-black, which will cause the black to knockout." & return & return & "Do you want this script to automatically convert all these objects to 99% Black?" & return & return buttons {"No", "Yes - Let Script Fix Blacks"} default button "Yes - Let Script Fix Blacks" with icon 2
if button returned of userResponse contains "No" then
return
end if
end tell
end if
if regsFound is true then
tell application "SystemUIServer"
activate
delay 0.5
set userResponse to display dialog " !!! W A R N I N G !!!" & return & return & "Found some black filled objects set to \"Registration\"." & return & return & "Objects set filled or stroked with Registration Color can not hold on press and will create undesirable efffects" & return & return & "Please change and Registration color filled objects to 99% Black." & return & return & "Do you want this script to automatically convert all objects filled with Registration to 99% Black, and any objects stroked with Registration to become 100% Black?" & return & return buttons {"No", "Yes - Let Script Fix Blacks"} default button "Yes - Let Script Fix Blacks" with icon 2
if button returned of userResponse contains "No" then
return
end if
end tell
end if
set allPageItems to object reference of all page items of document 1
repeat with i from 1 to count of items in allPageItems
try
set theClass to class of item i of allPageItems as string
on error
exit repeat
end try
if theClass is "rectangle" or theClass is "text field" or theClass is "text frame" or theClass is "polygon" or theClass contains "cpgn" or theClass contains "txtf" or theClass contains "crec" or theClass contains "govl" then
try
set y to fill color of item 1 of item i of allPageItems
set theTint to properties of y
set theProps to color value of y as string
set x to fill tint of item i of allPageItems as string
if theProps contains "0.00.00.0100.0" and x contains "-1.0" then
set properties of item i of allPageItems to {fill color:swatch "Black" of document 1}
set fill tint of item i of allPageItems to 99
else
if theProps contains "100.0100.0100.0100.0" and x contains "-1.0" then
set properties of item i of allPageItems to {fill color:swatch "Black" of document 1}
set fill tint of item i of allPageItems to 99
end if
end if
end try
--Try changine stroke colors of registration colors
try
set y to stroke color of item 1 of item i of allPageItems
set theTint to properties of y
set theProps to color value of y as string
set x to stroke tint of item i of allPageItems as string
if theProps contains "100.0100.0100.0100.0" and x contains "-1.0" then
set properties of item i of allPageItems to {stroke color:swatch "Black" of document 1}
end if
end try
end if
end repeat
end tell
end colorSpace
--Script Begins Here
tell application id "com.adobe.InDesign"
set user interaction level of script preferences to interact with all
set myStop to false
set blacksFound to false
my missingFonts()
if myStop is true then
return
end if
my mySpots()
my colorSpace()
if myStop is true then
return
end if
my oversets()
if myStop is true then
return
end if
my RGBCheck()
if myStop is true then
return
end if
my myDPI()
if myStop is true then
return
end if
my myPasteboard()
if myStop is true then
return
end if
tell application "SystemUIServer"
activate
set userResponse to display dialog "Finished Checking Document" buttons {"OK"} default button "OK" giving up after 2
end tell
tell application id "com.adobe.InDesign"
activate
end tell
end tell