Skip to main content
JohnVo
Inspiring
April 17, 2013
Question

how can i clean all guides in photoshop?

  • April 17, 2013
  • 2 replies
  • 5547 views

Hi

i have photoshop cs6 on my desktop windows7

and cs3 on my laptop xp

is there a script to delete all the guides ?

thanks

This topic has been closed for replies.

2 replies

Inspiring
April 17, 2013

// for versions earlier than CS5, also work in newer versions

function removeGuides(){

    var desc = new ActionDescriptor();

        var ref = new ActionReference();

        ref.putEnumerated( charIDToTypeID( "Gd  " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Al  " ) );

    desc.putReference( charIDToTypeID( "null" ), ref );

    executeAction( charIDToTypeID( "Dlt " ), desc, DialogModes.NO );

}

// CS5 or higher

app.activeDocument.guides.removeAll();

JohnVo
JohnVoAuthor
Inspiring
April 17, 2013

but it doesn't work

i create a file  guides.jsx with this code only and i tried to rename to guide.jz ,it doesn't clear guides in cs3

// for versions earlier than CS5, also work in newer versions

function removeGuides(){

    var desc = new ActionDescriptor();

        var ref = new ActionReference();

        ref.putEnumerated( charIDToTypeID( "Gd  " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Al  " ) );

    desc.putReference( charIDToTypeID( "null" ), ref );

    executeAction( charIDToTypeID( "Dlt " ), desc, DialogModes.NO );

}

pixxxelschubser
Community Expert
Community Expert
April 18, 2013

Michael L Hale wrote:

That code is from the scriptlistener plug-in. So is the code I posted. The only difference between the two is I cleaned up the code in the log and wrapped it in a function. If one works for you, the other should unless you made a copy/paste or save error. Or didn't call the function. It will not run unless called. i.e.

removeGuides();

There is one more difference:

mantralightroom wrote:

… and i tried to rename to guide.jz ,it doesn't clear guides in cs3 …

That can not work.

c.pfaffenbichler
Community Expert
Community Expert
April 17, 2013

Does View > Clear Guides record Action Manager code with ScriptingListener.plugin?

I can’t verify if that was already in CS4 (edited) CS3, though.

JohnVo
JohnVoAuthor
Inspiring
April 17, 2013
var id3 = charIDToTypeID( "Dlt " );
    var desc2 = new ActionDescriptor();
    var id4 = charIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var id5 = charIDToTypeID( "Gd  " );
        var id6 = charIDToTypeID( "Ordn" );
        var id7 = charIDToTypeID( "Al  " );
        ref1.putEnumerated( id5, id6, id7 );
    desc2.putReference( id4, ref1 );
executeAction( id3, desc2, DialogModes.NO );

this code works!

Inspiring
April 17, 2013

That code is from the scriptlistener plug-in. So is the code I posted. The only difference between the two is I cleaned up the code in the log and wrapped it in a function. If one works for you, the other should unless you made a copy/paste or save error. Or didn't call the function. It will not run unless called. i.e.

removeGuides();