All of a sudden, my picture labelling script is causing Quark 8 to crash. Still works fine in Quark 7, but even after a re-start, it crashes Quark 8 every time. I've used this 20/30 times a day for weeks.
global box_width, box_height
set box_width to 60
set box_height to 7
tell document 1 of application "QuarkXPress"
set oldSpreadSettings to item spread coords
set item spread coords to true
set theImageName to my NameFromPath(get file path of image 1 of current box as string)
set textBounds to my setBounds(bounds of current box as list)
make text box at beginning with properties {bounds:textBounds, color:"White", shade:100}
tell text box 1
set vertical justification to centered
set story 1 to theImageName
set size of story 1 to "8 pt"
end tell
set item spread coords to oldSpreadSettings
end tell
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 -1 of theImagePath) as string
return theImageName
end NameFromPath
on setBounds(theBounds)
set tempy to (item 1 of theBounds) as string
set the_offset to the offset of "m" in tempy
set y_coord to characters 1 thru (the_offset - 2) of tempy as string
set endy_coord to y_coord + box_height + 7 & " mm" as string
set y_coord to y_coord + box_height & " mm" as string
set tempx to (item 2 of theBounds) as string
set the_offset to the offset of "m" in tempx
set X_Coord to characters 1 thru (the_offset - 2) of tempx as string
set endx_coord to X_Coord + box_width & " mm" as string
set newBounds to {y_coord, item 2 of theBounds, endy_coord, endx_coord}
return newBounds
end setBounds
It runs fine if I comment out the 'set story 1...' and 'set size of story 1... ' lines. Investigations continue, but any suggestions would be welcome.