Here is a function and test script to place guides:
Code: Select allvar docRef = app.documents.add(500 ,600 ,72,"Test place guides" ,NewDocumentMode.RGB );
var horizPosition = "Hrzn";
var vertPosition = "Vrtc" ;
//Functions begin
function placeGuides(guideOrientation,guidePosition){
var id2049 = charIDToTypeID( "Mk " );
var desc431 = new ActionDescriptor();
var id2050 = charIDToTypeID( "Nw " );
var desc432 = new ActionDescriptor();
var id2051 = charIDToTypeID( "Pstn" );
var id2052 = charIDToTypeID( "#Pxl" );
desc432.putUnitDouble( id2051, id2052,guidePosition );
var id2053 = charIDToTypeID( "Ornt" );
var id2054 = charIDToTypeID( "Ornt" );
var id2055 = charIDToTypeID( guideOrientation );
desc432.putEnumerated( id2053, id2054, id2055 );
var id2056 = charIDToTypeID( "Gd " );
desc431.putObject( id2050, id2056, desc432 );
executeAction( id2049, desc431, DialogModes.NO );
return true;
};
var newHorGuide = placeGuides(horizPosition, 200);
var newVertGuide = placeGuides(vertPosition, 300);
Test place guides
Test place guides
There are functions to create and remove guides in Xbytor's stdlib as well.