• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Light blue artboard guides – script for Adobe Photoshop CC 2017

Guest
Jul 18, 2017 Jul 18, 2017

Copy link to clipboard

Copied

The script that you see creates a cyan guide at the left edge of the layer (or document).

Cyan guides are always visible, and light blue hides when switching artboards.

I would like to change the script so that it creates a light blue guide instead of cyan. How to do it?

Cyan canvas guides Light blue artboard guides

//Select Active Layer

var docRef = app.activeDocument,

activeLayer = docRef.activeLayer;

activeLayerCoordinates = activeLayer.bounds;

function traceGuide(guide) {

var orientation = '';

if(guide === 0 || guide === 2) {

orientation = Direction.VERTICAL;

} else if(guide === 1 || guide === 3) {

orientation = Direction.HORIZONTAL;

}

    docRef.guides.add(orientation,activeLayerCoordinates[guide]);

}

// Trace top guide

traceGuide(0);

https://static1.squarespace.com/static/54347ad9e4b052cb7a7eed93/t/565bfd91e4b0509baa0015e3/1448869267384/

Guides.png

TOPICS
Actions and scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 22, 2017 Jul 22, 2017

Hi alextul​,

try this

var desc1 = new ActionDescriptor();

    var desc2 = new ActionDescriptor();

    desc2.putUnitDouble( charIDToTypeID('Pstn'), charIDToTypeID('#Pxl'), 178 ); // position

    desc2.putEnumerated( charIDToTypeID('Ornt'), charIDToTypeID('Ornt'), charIDToTypeID('Vrtc') ); // vertical         //or horizontal --> Hrzn

    desc2.putEnumerated( charIDToTypeID('Knd '), charIDToTypeID('Knd '), charIDToTypeID('Dcmn') );

        var ref1 = new ActionReference();

        ref1.putIdentifier( charI

...

Votes

Translate

Translate
Adobe
Engaged ,
Jul 18, 2017 Jul 18, 2017

Copy link to clipboard

Copied

//Select Active Layer 

var docRef = app.activeDocument,

    activeLayer = docRef.activeLayer;

activeLayerCoordinates = activeLayer.bounds;

function traceGuide(guide) {

    var orientation = '';

    if (guide === 0 || guide === 2) {

        orientation = Direction.VERTICAL;

    } else if (guide === 1 || guide === 3) {

        orientation = Direction.HORIZONTAL;

    }

    docRef.guides.add(orientation, activeLayerCoordinates[guide]);

}

// Trace top guide 

traceGuide(0);

// Guid Blue

var idsetd = charIDToTypeID("setd");

var desc19 = new ActionDescriptor();

var idnull = charIDToTypeID("null");

var ref4 = new ActionReference();

var idPrpr = charIDToTypeID("Prpr");

var idGdPr = charIDToTypeID("GdPr");

ref4.putProperty(idPrpr, idGdPr);

var idcapp = charIDToTypeID("capp");

var idOrdn = charIDToTypeID("Ordn");

var idTrgt = charIDToTypeID("Trgt");

ref4.putEnumerated(idcapp, idOrdn, idTrgt);

desc19.putReference(idnull, ref4);

var idT = charIDToTypeID("T   ");

var desc20 = new ActionDescriptor();

var idGdsC = charIDToTypeID("GdsC");

var idGdGr = charIDToTypeID("GdGr");

var idLgtB = charIDToTypeID("LgtB");

desc20.putEnumerated(idGdsC, idGdGr, idLgtB);

var idGdPr = charIDToTypeID("GdPr");

desc19.putObject(idT, idGdPr, desc20);

executeAction(idsetd, desc19, DialogModes.NO);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 19, 2017 Jul 19, 2017

Copy link to clipboard

Copied

I can change the color of the guides in the settings without scripts.

I need the script to create artboard guides instead of canvas guides. This means that they must be hidden when switching artboards.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 22, 2017 Jul 22, 2017

Copy link to clipboard

Copied

Help me please.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 22, 2017 Jul 22, 2017

Copy link to clipboard

Copied

Hi alextul​,

try this

var desc1 = new ActionDescriptor();

    var desc2 = new ActionDescriptor();

    desc2.putUnitDouble( charIDToTypeID('Pstn'), charIDToTypeID('#Pxl'), 178 ); // position

    desc2.putEnumerated( charIDToTypeID('Ornt'), charIDToTypeID('Ornt'), charIDToTypeID('Vrtc') ); // vertical         //or horizontal --> Hrzn

    desc2.putEnumerated( charIDToTypeID('Knd '), charIDToTypeID('Knd '), charIDToTypeID('Dcmn') );

        var ref1 = new ActionReference();

        ref1.putIdentifier( charIDToTypeID('Dcmn'), 211 );

        ref1.putIndex( charIDToTypeID('Gd  '), 1 );

    desc2.putReference( charIDToTypeID('null'), ref1 );

desc1.putObject( charIDToTypeID('Nw  '), charIDToTypeID('Gd  '), desc2 );

    var ref2 = new ActionReference();

    ref2.putClass( charIDToTypeID('Gd  ') );

desc1.putReference( charIDToTypeID('null'), ref2 );

desc1.putEnumerated( stringIDToTypeID('guideTarget'), stringIDToTypeID('guideTarget'), stringIDToTypeID('guideTargetSelectedArtboard') );

executeAction( charIDToTypeID('Mk  '), desc1, DialogModes.NO );

(an artboard should exists in your document, otherwise a "normal" guide will be created)

Have fun

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 23, 2017 Jul 23, 2017

Copy link to clipboard

Copied

Hi pixxxel schubser, your script creates a guide at a distance of 178 pixels from the border of the artboard. Can I somehow make the guide stick to the layer (or the artboard, if there are no layers) and to the pixel selection area?

And if possible, let the script create four guides at each edge of the layer (artboard) or the pixel selection area, as well as two guides along the center (horizontal and vertical).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 23, 2017 Jul 23, 2017

Copy link to clipboard

Copied

Read the selection.bounds[array] and use the values.

This also should helps you on your way: Re: How to get artboard properties in photoshop CC 2015?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 23, 2017 Jul 23, 2017

Copy link to clipboard

Copied

Many thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 15, 2023 Sep 15, 2023

Copy link to clipboard

Copied

LATEST

('#Pxl'), 178 ) how to change inches plz sir

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines