Action/Script to select everything above guide?

Community Beginner ,
Jul 26, 2022 Jul 26, 2022

Copy link to clipboard

Copied

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?

TOPICS
Actions and scripting

Views

76

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Jul 27, 2022 Jul 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]]])

Likes

Translate

Translate
Adobe Community Professional ,
Jul 26, 2022 Jul 26, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 26, 2022 Jul 26, 2022

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 27, 2022 Jul 27, 2022

Copy link to clipboard

Copied

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]]])

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 27, 2022 Jul 27, 2022

Copy link to clipboard

Copied

Thank you, that did it.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 27, 2022 Jul 27, 2022

Copy link to clipboard

Copied

LATEST

jazz-y has come to the rescue yet again, I was just going to suggest that you use Select > Reselect and then Select > Inverse, assuming that the original marquee selection was in that session without another selection being added (also assuming that the original selection went all the way to the canvas edges...yes, a lot of assumptions!).

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines