AppleScript, Mac Sequoia and Quark Xpress 2026 Issue

Hi, I am new here and have been driven nuts by a script failure. We are still using Quark - the current version - and have a number of scripts to help automate catalogue production. Most of the scripts still function despite having been written (by someone else who is at best unreachable and at worst deceased) 10 years ago. On a Yosemite machine running Quark 2015 this auto caption script is fine if run from the Quark script menu. On Sequoia and Quark 2026 it stalls - no errors, just nothing. I have tried stepping through it in Script Editor and Script Debugger but it crashes out at the same point on the working system as it does the non working system. ( set X to left of bounds as real). I have added beeps and it beeps 1, 2 then 3 times but stops before “beep 4”.

–set CaptionHeight to “”

property DocName : “”

property LabelStyle : false

property pageNo : “”

property X : “”

property Y : “”

tell application “QuarkXPress 2026”

–set QCaptionHeight to “What Height in mm do you want your image captions?”

–set CH to display dialog QCaptionHeight default answer 4.939 with icon note

set CaptionHeight to 4.939 --((text returned of CH))

set DocName to name of document 1

set pageNo to page number of current page of document DocName as string

beep 1

tell document DocName

if not (exists style spec “Caption”) then my makeNewLabelStyles()

–end tell

–tell page pageNo of document DocName

try

set pixThatNeedCaption to object reference of every picture box whose selected is true

on error

display dialog “you need to have at least one picture box, and only picture boxes selected for this script to run”

return

end try

beep 2

repeat with thisPicBox from 1 to (count of pixThatNeedCaption)

tell item thisPicBox of pixThatNeedCaption

–display dialog thisPicBox as string

–set selected to true

–set color to “None”

set X to left of bounds as real

set Y to top of bounds as real

set picWidth to ((right of bounds as real) - X) as real

set picHeight to ((bottom of bounds as real) - Y) as real

beep 3

–set theImageName to my NameFromPath(get file path of image 1 as string)

set t to path of image 1 as string

–tell application “Finder”

set theImageName to name of t

–display dialog theImageName as string

–end tell

beep 4

set selected to false

–set makeTextBoxes to

my makeNewTextBox(X, Y + picHeight, Y + picHeight + CaptionHeight, X + picWidth, (thisPicBox as string) & " p" & pageNo, theImageName)

–set selected to false

end tell

–end if

end repeat

end tell

end tell

on makeNewTextBox(X, Y, H, W, BoxName, caption)

tell application “QuarkXPress 2026”

tell page pageNo of document DocName

make new text box at beginning with properties {vertical justification:bottom justified, name:(“textBox” & BoxName), color:“None”, bounds:{(Y), (X), (H), (W)}}

set selected of text box (“textBox” & BoxName) to true

set story 1 of text box (“textBox” & BoxName) to “NoZero” & caption

end tell

tell document DocName

set style sheet of paragraph 1 of text box (“textBox” & BoxName) to style spec “Caption”

end tell

tell page pageNo of document DocName

try

set every text of story 1 of text box (“textBox” & BoxName) where it is “NoZero000” to “”

set every text of story 1 of text box (“textBox” & BoxName) where it is “NoZero00” to “”

set every text of story 1 of text box (“textBox” & BoxName) where it is “NoZero0” to “”

set every text of story 1 of text box (“textBox” & BoxName) where it is “NoZero” to “”

set every text of story 1 of text box (“textBox” & BoxName) where it is “.tif” to “”

set every text of story 1 of text box (“textBox” & BoxName) where it is “.psd” to “”

set every text of story 1 of text box (“textBox” & BoxName) where it is “.eps” to “”

set every text of story 1 of text box (“textBox” & BoxName) where it is “.jpg” to “”

set every text of story 1 of text box (“textBox” & BoxName) where it is “.jpeg” to “”

end try

–set grouped of group box 1 to true

end tell

end tell

end makeNewTextBox

(*

on NameFromPath(theImagePath)

set theOffset to the offset of “:” in (the reverse of every character of theImagePath) as string

set theImageName to (characters -(theOffset - 1) thru -5 of theImagePath) as string

end NameFromPath

*)

on makeNewLabelStyles()

tell application “QuarkXPress 2026”

tell document DocName

make new character spec at beginning with properties {name:“Caption”, base style:“Normal”}

make new style spec at beginning with properties {name:“Caption”, base style:“Normal”, paragraph attributes:{justification:centered }, character style:“Caption”}

end tell

end tell

end makeNewLabelStyles