// php skript indesigni skripti tegemiseks :)
var myDocument=app.activeDocument;



function addtextbox(pagenr,x1,y1,x2,y2,tstyle,tcontents) {
with(myDocument){
with(pages.item(pagenr-1)){
	tTextFrame=textFrames.add();
	tTextFrame.geometricBounds=[y1,x1,y2,x2];
	tTextFrame.contents=tcontents;
	tTextFrame.texts.item(0).appliedParagraphStyle=tstyle;
}
}
}

function addtextboxwithstroke(pagenr,x1,y1,x2,y2,tstyle,tcontents,tstrokeWeight,tstrokeSwatch) {
with(myDocument){
with(pages.item(pagenr-1)){
	tTextFrame=textFrames.add();
	tTextFrame.geometricBounds=[y1,x1,y2,x2];
	tTextFrame.contents=tcontents;
	tTextFrame.strokeWeight=tstrokeWeight;
	tTextFrame.cornerEffect=CornerEffects.roundedCorner;
	tTextFrame.cornerRadius=0.5;
	tTextFrame.strokeColor=swatches.item(tstrokeSwatch);
	tTextFrame.texts.item(0).appliedParagraphStyle=tstyle;
}
}
}


function addmainbox(pagenr,x1,y1,x2,y2,tcontents) {
with(myDocument){
with(pages.item(pagenr-1)){
	tTextFrame=textFrames.add();
	tTextFrame.geometricBounds=[y1,x1,y2,x2];
	tTextFrame.contents=tcontents;
	tTextFrame.paragraphs.item(0).appliedParagraphStyle="kirik_e";
	tTextFrame.paragraphs.item(1).appliedParagraphStyle="kirik_i";
	tTextFrame.paragraphs.item(2).appliedParagraphStyle="aadress";
	tTextFrame.paragraphs.item(3).appliedParagraphStyle="huvitav_e";
	tTextFrame.paragraphs.item(4).appliedParagraphStyle="huvitav_i";
}
}
}

function drawrectangle(pagenr,x1,y1,x2,y2,tFillSwatch) {
with(myDocument){
with(pages.item(pagenr-1)){
	tRectangle=rectangles.add();
	tRectangle.geometricBounds=[y1,x1,y2,x2];
	tRectangle.fillColor=swatches.item(tFillSwatch);
	tRectangle.strokeWeight=0;
}
}
}