Skip to main content
Known Participant
October 10, 2011
Answered

Switch "show guides" from script

  • October 10, 2011
  • 1 reply
  • 1146 views

Hi, I wonder if there is a way to switch on/off guides from script/actionmanager?

This topic has been closed for replies.
Correct answer

Just what I was afraid of

BTW I found out that when I create a guide using action manager guides are switched to "visible" state even if there  were before hidden. It could be probably used as "switch on" if you would be able to delete the guide you just created.Unfortunatelly I know only how to delte all guides at once. Does anybody know how to delete particular guide using action manager?


Maybe you could put an undo after creating a guide.

// =======================================================

var id19 = charIDToTypeID( "undo" );

executeAction( id19, undefined, DialogModes.NO );

MTSTUNER

1 reply

October 11, 2011

You can get a lot of those functions for scripting by installing the script listener.

In the case of switch guides on/of (toggle guides) you have to actually record an action

using insert menu item View>Show>Guides to get a script listener output.

// =======================================================

var id19 = charIDToTypeID( "slct" );

    var desc6 = new ActionDescriptor();

    var id20 = charIDToTypeID( "null" );

        var ref1 = new ActionReference();

        var id21 = charIDToTypeID( "Mn  " );

        var id22 = charIDToTypeID( "MnIt" );

        var id23 = charIDToTypeID( "Tgld" );

        ref1.putEnumerated( id21, id22, id23 );

    desc6.putReference( id20, ref1 );

executeAction( id19, desc6, DialogModes.NO );

MTSTUNER

lukychanAuthor
Known Participant
October 11, 2011

Thanks, I have script listener but it never shows this. I have one more question though. This code toggles visibility of guides. Is there a way how to toggle only when guides are not visible?.

i was experimenting with enumClearGuides "ClrG" but only thing I've achieved was that guides become disabled and can't be turned on regardless whatever I did

Inspiring
October 11, 2011

They do not become disabled they are cleared… 'ClrG' is more likely 'clear guides'… I would have expected 'Tgld' to be toggle but may be not didn't try…