var saveRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.displayDialogs = DialogModes.NO;
var aDoc = app.activeDocument;
var cmRes = aDoc.resolution /2.54;
// Stroke's parameters
var strokeColor = new SolidColor ();
strokeColor.cmyk.cyan =0;
strokeColor .cmyk.magenta = 0;
strokeColor.cmyk.yellow = 0;
strokeColor.cmyk.black = 40;
var h = 10; //высота
var b = 40; //ширина
var c = 8.5; //ширина равных сегментов
var x = 1; //нахлест
var d = 6-x; //ширина последнего сегмента - нахлест
var j = 0;
// 1 сегмент
var dupDoc = aDoc.duplicate();
app.activeDocument = dupDoc;
bounds = new Array(0*cmRes,0*cmRes,(b-(3*c+d))*cmRes,h*cmRes); // left, top, right, bottom
dupDoc.crop(bounds);
// Stroke
var selRef = dupDoc.selection;
selRef.selectAll();
selRef.stroke(strokeColor, 1, StrokeLocation.CENTER, ColorBlendMode.NORMAL, 100, false);
var j = j+1;
SaveAsTIFF (dupDoc, ( "_" + j))
function SaveAsTIFF( docRef, saveAsName ) {
var tso = new TiffSaveOptions();
tso.embedColorProfile = false;
tso.imageCoinpression = TIFFEncoding.NONE;
tso.byteOrder = ByteOrder.IBM;
docRef.saveAs( File( saveAsName ), tso );
docRef.close();
}
//2 сегмент
var dupDoc = aDoc.duplicate();
app.activeDocument = dupDoc;
bounds = new Array(c*cmRes,0*cmRes,(b-(2*c+d))*cmRes,h*cmRes); // left, top, right, bottom
dupDoc.crop(bounds);
// Stroke
var selRef = dupDoc.selection;
selRef.selectAll();
selRef.stroke(strokeColor, 1, StrokeLocation.CENTER, ColorBlendMode.NORMAL, 100, false);
var j = j+1;
SaveAsTIFF (dupDoc, ( "_" + j))
function SaveAsTIFF( docRef, saveAsName ) {
var tso = new TiffSaveOptions();
tso.embedColorProfile = false;
tso.imageCoinpression = TIFFEncoding.NONE;
tso.byteOrder = ByteOrder.IBM;
docRef.saveAs( File( saveAsName ), tso );
docRef.close();
}
//3 сегмент
var dupDoc = aDoc.duplicate();
app.activeDocument = dupDoc;
bounds = new Array(2*c*cmRes,0*cmRes,(b-(c+d))*cmRes,h*cmRes); // left, top, right, bottom
dupDoc.crop(bounds);
// Stroke
var selRef = dupDoc.selection;
selRef.selectAll();
selRef.stroke(strokeColor, 1, StrokeLocation.CENTER, ColorBlendMode.NORMAL, 100, false);
var j = j+1;
SaveAsTIFF (dupDoc, ( "_" + j))
function SaveAsTIFF( docRef, saveAsName ) {
var tso = new TiffSaveOptions();
tso.embedColorProfile = false;
tso.imageCoinpression = TIFFEncoding.NONE;
tso.byteOrder = ByteOrder.IBM;
docRef.saveAs( File( saveAsName ), tso );
docRef.close();
}
//4 сегмент
var dupDoc = aDoc.duplicate();
app.activeDocument = dupDoc;
bounds = new Array(3*c*cmRes,0*cmRes,(b-(c*0+d))*cmRes,h*cmRes); // left, top, right, bottom
dupDoc.crop(bounds);
// Stroke
var selRef = dupDoc.selection;
selRef.selectAll();
selRef.stroke(strokeColor, 1, StrokeLocation.CENTER, ColorBlendMode.NORMAL, 100, false);
var j = j+1;
SaveAsTIFF (dupDoc, ( "_" + j))
function SaveAsTIFF( docRef, saveAsName ) {
var tso = new TiffSaveOptions();
tso.embedColorProfile = false;
tso.imageCoinpression = TIFFEncoding.NONE;
tso.byteOrder = ByteOrder.IBM;
docRef.saveAs( File( saveAsName ), tso );
docRef.close();
}
//5 сегмент
var dupDoc = aDoc.duplicate();
app.activeDocument = dupDoc;
bounds = new Array(4*c*cmRes,0,b*cmRes,h*cmRes); // left, top, right, bottom
dupDoc.crop(bounds);
// Stroke
var selRef = dupDoc.selection;
selRef.selectAll();
selRef.stroke(strokeColor, 1, StrokeLocation.CENTER, ColorBlendMode.NORMAL, 100, false);
var j = j+1;
SaveAsTIFF (dupDoc, ( "_" + j))
function SaveAsTIFF( docRef, saveAsName ) {
var tso = new TiffSaveOptions();
tso.embedColorProfile = false;
tso.imageCoinpression = TIFFEncoding.NONE;
tso.byteOrder = ByteOrder.IBM;
docRef.saveAs( File( saveAsName ), tso );
docRef.close();
}
app.preferences.rulerUnits = Units.CM;