Photoshop: Clear Horizontal or Vertical Guides

  • 2
  • Idea
  • Updated 12 months ago
  • (Edited)
Often when I'm designing for mobile screens in Photoshop, the interfaces change and I'd like to be able to selectively clear only horizontal guides. I suggest including a sub-option to the existing clear guides > clear horizontal guides and clear vertical guides.
Photo of Michael Cherun

Michael Cherun

  • 7 Posts
  • 0 Reply Likes

Posted 12 months ago

  • 2
Photo of Paul Riggott

Paul Riggott

  • 359 Posts
  • 141 Reply Likes
It can be done with a script....

#target photoshop;
if(documents.length){
var count = app.activeDocument.guides.length;
for(var a =count -1;a>=0;a--){
if (ScriptUI.environment.keyboardState.shiftKey){
if(app.activeDocument.guides[a].direction==Direction.VERTICAL) app.activeDocument.guides[a].remove();
}else{
if(app.activeDocument.guides[a].direction==Direction.HORIZONTAL) app.activeDocument.guides[a].remove();
    }
}
};

If you just run the script all Horizontal guides are removed, if you run the script with the shift key pressed Vertical guides are removed.
Photo of Michael Cherun

Michael Cherun

  • 7 Posts
  • 0 Reply Likes
Wow Paul.... I'm new to scripts but managed to get the default horizontal script working. Thanks for the quick reply!

For other script newbies:

  • I pasted the script code above into notepad and saved it in an Adobe Scripts subfolder  I created in My Documents folder (in Windows).
  • I saved it as a .jsx file
  • Then in photoshop I chose File > Scripts > Browse and loaded the file.
I don't know how to have it appear as a script that I can always access but this method works. If someone has an easier method, feel free to comment.
(Edited)
Photo of Paul Riggott

Paul Riggott

  • 359 Posts
  • 141 Reply Likes
You can create an action to call the script and you can set the action to be called from a function key.
When createing the action use "Inset Menu Item" from the action palette fly out menu, then File - Scripts - Select the script.
You just need to hold the shift key down when running the script either by an action/function key or selecting the script.
N.B. the script should be saved in the Applications presets/scripts folder.
Best of luck.
Photo of Michael Cherun

Michael Cherun

  • 7 Posts
  • 0 Reply Likes
Worked like a charm... though I couldn't find the "Inset menu". I just created a new Action and recorded myself using the script which worked fine. (I managed to find the inset menu a bit later).
(Edited)