Skip to main content
Participant
August 4, 2008
Question

Add Guides automaticly

  • August 4, 2008
  • 3 replies
  • 382 views
Hi,

i would like to write a script which automaticly generates 4 guides, all of them should have a displacement of 1 cm from the border, so i can be sure, that non of the information on the flyer is out of range.

I would be happy, if you could give me a hint how to..but i am not good in js.

thanks
This topic has been closed for replies.

3 replies

Paul Riggott
Inspiring
August 5, 2008
No problem, glad its of use to you.
Participant
August 5, 2008
Thank you very much for your very quick reply. If you don't object, i would like to share this script with others under your name?

Thanks a lot again, it's a very helpfull script.

http://www.imandesign.at
Paul Riggott
Inspiring
August 4, 2008
This should do it.



if(documents.length >0){

var startRulerUnits = preferences.rulerUnits

preferences.rulerUnits = Units.PIXELS

var doc = activeDocument;

var res = doc.resolution;

var CM = res/2.54;

var rightguide =doc.width - CM;

var bottomguide =doc.height - CM;

var leftguide = CM;

var topguide = CM;

guideLine(topguide,"Hrzn");

guideLine(bottomguide,"Hrzn");

guideLine(rightguide,"Vrtc");

guideLine(leftguide,"Vrtc");

preferences.rulerUnits = startRulerUnits;

}

function guideLine(position, type) {

var id296 = charIDToTypeID( "Mk " );

var desc50 = new ActionDescriptor();

var id297 = charIDToTypeID( "Nw " );

var desc51 = new ActionDescriptor();

var id298 = charIDToTypeID( "Pstn" );

var id299 = charIDToTypeID( "#Pxl" );

desc51.putUnitDouble( id298, id299, position );

var id300 = charIDToTypeID( "Ornt" );

var id301 = charIDToTypeID( "Ornt" );

var id302 = charIDToTypeID( type );

desc51.putEnumerated( id300, id301, id302 );

var id303 = charIDToTypeID( "Gd " );

desc50.putObject( id297, id303, desc51 );

executeAction( id296, desc50, DialogModes.NO );

};