Hi. I had a custom crops script for InDesign that I wrote for CS3 and somehow it is now erroring out in CS5 and CS6. It seems to have something to do with using variables instead of constants, but for the life of me I can’t seem to figure it out.
Here’s a chunk of the script that illustrates the issue:
tell application "Adobe InDesign CS6"
activate
tell view preferences
set horizontal measurement units to inches
set vertical measurement units to inches
end tell
set myDoc to make document
tell myDoc
set myDocPrefs to document preferences
tell myDocPrefs
set page width to 7
set page height to 7
set pages per document to 1
set facing pages to false
set document bleed inside or left offset to 0.5
set document bleed outside or right offset to 0.5
set document bleed top offset to 0.5
set document bleed bottom offset to 0.5
set slug top offset to 1
set slug right or outside offset to 1
end tell
set myLayer to make layer with properties {name:"Crops"}
end tell
set myBleedH to 8 as real
set myBleedV to 8 as real
set myTrimH to 7 as real
set myTrimV to 7 as real
set mySafetyH to 6 as real
set mySafetyV to 6 as real
set mySwatch to "Black"
set myBleedHOffset to (myBleedH - myTrimH) / 2 as real
set myBleedVOffset to (myBleedV - myTrimV) / 2 as real
set k to 1
tell document 1
if myBleedH is not equal to 0 and myBleedV is not equal to 0 then
set myBleedHOffset to (myBleedH - myTrimH) / 2 as real
set myBleedVOffset to (myBleedV - myTrimV) / 2 as real
--Bleed Crops
make graphic line of page k with properties {geometric bounds:{-(myBleedVOffset + 0.5), -(myBleedHOffset), -(myBleedVOffset + 0.125), -(myBleedHOffset)}, stroke weight:0.25, stroke tint:100, stroke color:swatch mySwatch, item layer:layer "Crops"}
make graphic line of page k with properties {geometric bounds:{-(myBleedVOffset + 0.5), myTrimH + myBleedHOffset, -(myBleedVOffset + 0.125), myTrimH + myBleedHOffset}, stroke weight:0.25, stroke tint:100, stroke color:swatch mySwatch, item layer:layer "Crops"}
make graphic line of page k with properties {geometric bounds:{-(myBleedVOffset), -(myBleedHOffset + 0.5), -(myBleedVOffset), -(myBleedHOffset + 0.125)}, stroke weight:0.25, stroke tint:100, stroke color:swatch mySwatch, item layer:layer "Crops"}
make graphic line of page k with properties {geometric bounds:{-(myBleedVOffset), (myTrimH + myBleedHOffset + 0.5), -(myBleedVOffset), (myTrimH + myBleedHOffset + 0.125)}, stroke weight:0.25, stroke tint:100, stroke color:swatch mySwatch, item layer:layer "Crops"}
make graphic line of page k with properties {geometric bounds:{(myTrimV + myBleedVOffset + 0.5), -(myBleedHOffset), (myTrimV + myBleedVOffset + 0.125), -(myBleedHOffset)}, stroke weight:0.25, stroke tint:100, stroke color:swatch mySwatch, item layer:layer "Crops"}
make graphic line of page k with properties {geometric bounds:{(myTrimV + myBleedVOffset + 0.5), myTrimH + myBleedHOffset, (myTrimV + myBleedVOffset + 0.125), myTrimH + myBleedHOffset}, stroke weight:0.25, stroke tint:100, stroke color:swatch mySwatch, item layer:layer "Crops"}
make graphic line of page k with properties {geometric bounds:{myTrimV + myBleedVOffset, -(myBleedHOffset + 0.5), myTrimV + myBleedVOffset, -(myBleedHOffset + 0.125)}, stroke weight:0.25, stroke tint:100, stroke color:swatch mySwatch, item layer:layer "Crops"}
make graphic line of page k with properties {geometric bounds:{myTrimV + myBleedVOffset, (myTrimH + myBleedHOffset + 0.5), myTrimV + myBleedVOffset, (myTrimH + myBleedHOffset + 0.125)}, stroke weight:0.25, stroke tint:100, stroke color:swatch mySwatch, item layer:layer "Crops"}
--this is the problem area. The first line using variables errors out on the point size. The second line using constants works
--set myHorizFrame to make text frame of page k with properties {geometric bounds:{-(myBleedVOffset + 1), 2, -(myBleedVOffset + 0.44), 4}, fill tint:100, fill color:swatch "Paper", stroke weight:0, stroke tint:0, label:"BleedH_" & k, layer:layer "Crops"}
set myHorizFrame to make text frame of page k with properties {geometric bounds:{-0.5, 2, -1.06, 4}, fill tint:100, fill color:swatch "Paper", stroke weight:0, stroke tint:0, label:"BleedH_" & k, layer:layer "Crops", contents:"Hello"}
tell myHorizFrame
set point size of characters of myHorizFrame to 7
set leading of characters of myHorizFrame to 7
set applied font of characters of myHorizFrame to "Helvetica"
set font style of characters of myHorizFrame to "Regular"
set justification of characters of myHorizFrame to right align
end tell
end if
end tell
end tell
The script as is should run and produce a page in InDesign CS6 with bleed marks, an arrowed line between the top horizontal crops and then build a box to put in the dimension. It’s currently using constants. If you comment out the “set myHorizFrame” line and uncomment the one above, the script errors out on the set point size line below.
Can anyone point out what might be going wrong?
Thanks.
Model: MacBookPro
AppleScript: 2.5
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)