Skip to main content
Known Participant
July 16, 2023
Question

How do hide page-specific guides with specific item names?

  • July 16, 2023
  • 2 replies
  • 477 views

How can I "hide" a specific guide that has been rendered under an event handler?

 

Maybe I can't delete guides, but I can try hiding them if anyone can provide an example of page-specific guides being hidden. 

This topic has been closed for replies.

2 replies

m1b
Community Expert
Community Expert
July 16, 2023

There doesn't appear to be a way to hide an indivisual guide according to the api for Guide but there may be a workaround: you could "hide" a guide by coloring it the same color as the paper:

// just an example guide
var guide = app.activeDocument.guides[0];
// this stops the guide being visible into the pasteboard
guide.fitToPage = true;
// make this match your paper
guide.guideColor = [255, 255, 255];

- Mark

 

(I have posted this on your other question, but it is more pertinent to this thread, so I'll repeat it here in case anyone finds this question.)

Known Participant
July 16, 2023

I'm still confused here, I have little experience with JS. I'd like to hide a select number of guides using an onChange function of a slider on a specific actively selected page.


Currently the way I add several guides at a time is using the following loop

 

for (var i = 1; i < 5; ++i) {
        app.activeWindow.activePage.guides.add({ name: "Blah" + i, location: docWidth * i * 0.1, orientation: HorizontalOrVertical.VERTICAL });
    }
 
Now, once these guides are drawn, is there a way I can create a button that will hide a variable number of them?
m1b
Community Expert
Community Expert
July 16, 2023

Hi @dane13860245, you can remove specific guides. See my answer on your other post.

- Mark

Known Participant
July 16, 2023

Thank you for the reply, but I would still like to know how to hide/unhide guides as an option to explore.