Skip to main content
New Participant
July 27, 2022
Answered

Action/Script to select everything above guide?

  • July 27, 2022
  • 1 reply
  • 493 views

Hi, I have a document where I executed a script creating a single horizontal guide based on a marquee selection. That guide is always in a different position.
Now I want to make a new marquee selection (the old one is deselected), selecting everything above that guide (the selection attached to it).
Is there an action or script for this?

This topic has been closed for replies.
Correct answer jazz-y
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS
var aDoc = activeDocument;
var Sel = aDoc.selection.bounds;
aDoc.guides.add(Direction.HORIZONTAL, Sel[1]);
activeDocument.selection.select([[0,0], [activeDocument.width,0], [activeDocument.width, Sel[1]], [0, Sel[1]]])

1 reply

Stephen Marsh
Adobe Expert
July 27, 2022

@TK949 – It may help to share the original script in order to create a new script to "pick up where it left off"...

TK949Author
New Participant
July 27, 2022

Found it here in the discussions:

// regards pixxxel schubser

var aDoc = activeDocument;

var Sel = aDoc.selection.bounds;

aDoc.guides.add(Direction.HORIZONTAL, Sel[1].as('px'));

I'm a total noob with scripts.

jazz-yCorrect answer
Brainiac
July 27, 2022
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS
var aDoc = activeDocument;
var Sel = aDoc.selection.bounds;
aDoc.guides.add(Direction.HORIZONTAL, Sel[1]);
activeDocument.selection.select([[0,0], [activeDocument.width,0], [activeDocument.width, Sel[1]], [0, Sel[1]]])