tell application "Adobe InDesign CS2"
set allSel to selection
set {minY, minX, maxY, maxX} to visible bounds of item 1 of allSel
repeat with n from 2 to count allSel
set {t, l, b, r} to visible bounds of item n of allSel
if t < minY then set minY to t
if l < minX then set minX to l
if b > maxY then set maxY to b
if r > maxX then set maxX to r
end repeat
set prevWidth to maxX - minX
set prevHeight to maxY - minY
set myDialog to make dialog with properties {name:"auf mm skalieren"}
tell myDialog
make dialog column
tell the result
make static text with properties {static label:"Neue Breite:"}
make static text with properties {static label:"Neue Höhe:"}
make static text with properties {static label:"Proportional:"}
end tell
make dialog column
tell the result
set nuXSizeField to make measurement editbox with properties {edit value:(prevWidth * 2.83465), edit units:millimeters}
set nuYSizeField to make measurement editbox with properties {edit value:prevHeight * 2.83465, edit units:millimeters}
set nuProp to make checkbox control with properties {checked state:true, static label:" "}
end tell
end tell
set nu to show myDialog
if nu is true then
set nuXSize to (edit value of nuXSizeField) * 0.35278
set nuYSize to (edit value of nuYSizeField) * 0.35278
if checked state of nuProp is true then
if prevWidth = nuXSize then
set xScale to nuYSize / prevHeight
set yscale to nuYSize / prevHeight
else
set xScale to nuXSize / prevWidth
set yscale to nuXSize / prevWidth
end if
else
set xScale to nuXSize / prevWidth
set yscale to nuYSize / prevHeight
end if
set xScale to xScale * 100
set yscale to yscale * 100
set fixPoint to transform reference point of layout window 1
set oben to {top left anchor, top center anchor, top right anchor}
set ymitte to {left center anchor, center anchor, right center anchor}
set unten to {bottom left anchor, bottom center anchor, bottom right anchor}
set myLinks to {top left anchor, left center anchor, bottom left anchor}
set xmitte to {top center anchor, center anchor, bottom center anchor}
set rechts to {top right anchor, right center anchor, bottom right anchor}
if fixPoint is in oben then
set aroundY to minY
else if fixPoint is in ymitte then
set aroundY to (maxY - minY) / 2 + minY
else
set aroundY to maxY
end if
if fixPoint is in myLinks then
set aroundX to minX
else if fixPoint is in xmitte then
set aroundX to (maxX - minX) / 2 + minX
else
set aroundX to maxX
end if
set fixPoint to {aroundX, aroundY}
repeat with aSel in allSel
resize aSel horizontal scale xScale vertical scale yscale around fixPoint
end repeat
-- destroy dialog
else
destroy myDialog
return
end if
end tell