Hi all,
I want to write a script which will alert the error message if the page items are outside of the workarea.Any object placed outside the page area should generate error message.
Thanks,
Sanat
this should alert whenever an item is outside the document bounds ... please keep in mind that this script assumes that first artboard is default and thus set to the size of the document:
var doc = app.activeDocument;
var artboard = doc.artboards[0];
var version = parseInt(app.version);
//workarea aka artboard differs slightly from CS4
if(version > 13) {
if(doc.artboards.length > 1) {
var dlg = prompt("Object should be inside which artboard?", "1", "Artboard number?");
artboard = (dlg != null) ? doc.artboards[parseInt[dlg]-1] : artboard;
}
}
var ar = artboard.artboardRect;
var dv = doc.visibleBounds;
if(dv[0] < ar[0] || dv[1] < ar[1] || dv[2] < ar[2] || dv[3] < ar[3]) {
alert("There are some objects outside the visible bounds!");
} else {
alert("Thanks god ... they`re all in!");
}
hope it helps;
cheers;
North America
Europe, Middle East and Africa
Asia Pacific