Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Finding Hot Key or Trick to select portion of window (description in post)

New Here ,
Dec 28, 2022 Dec 28, 2022

Hey everyone. I was wondering the other day, if there is a key stroke or menu function to select only the "current visible" portion of your window or document. For instance....

 

If you hit command A, it will select the entire canvas. But if you zoom in to a specific are of an image to fill your screen, is there a way to select only THIS new portion? If you hit command A zoomed in, it will still only select the entire image.

 

I know this is possible with dragging a box using the Marquee tool, but is there a method using a hot key or menu option?

 

Thanks!

 

TOPICS
Actions and scripting
217
Translate
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 Expert ,
Dec 28, 2022 Dec 28, 2022

@Steven27731193f03o 

 

No, you cannot select the visible area with a hot key or menu option. You can continue using the Rectangular Marquee as you have been doing.

 

Jane

 

Translate
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
LEGEND ,
Dec 28, 2022 Dec 28, 2022

This could possibly be done with a script. Details are left as an exercise for the reader.

Translate
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
Mentor ,
Jan 12, 2023 Jan 12, 2023
LATEST

There is no such command , but having access to information about the size of the work area, zoom, document size, offsets of the document borders from the work area, we can make such a selection using a script:

 

#target photoshop
s2t = stringIDToTypeID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('resolution'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var res = executeActionGet(r).getInteger(p);
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('width'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var docW = executeActionGet(r).getInteger(p) * res / 72;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('height'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var docH = executeActionGet(r).getInteger(p) * res / 72;    
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('viewTransform'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var viewTransform = executeActionGet(r).getList(p),
    zoom = viewTransform.getDouble(0),
    offsetLeft = viewTransform.getDouble(4),
    offsetTop = viewTransform.getDouble(5);
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('viewInfo'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var activeView = executeActionGet(r).getObjectValue(p).getObjectValue(s2t('activeView')).getObjectValue(s2t('globalBounds')),
    viewW = activeView.getDouble(s2t('right')) - activeView.getDouble(s2t('left')),
    viewH = activeView.getDouble(s2t('bottom')) - activeView.getDouble(s2t('top'));
makeSelection(offsetTop < 0 ? 0 : offsetTop,
    offsetLeft < 0 ? 0 : offsetLeft,
    viewH * zoom + offsetTop > docH ? docH : viewH * zoom + offsetTop,
    viewW * zoom + offsetLeft > docW ? docW : viewW * zoom + offsetLeft
)
function makeSelection(top, left, bottom, right) {
    var d = new ActionDescriptor();
    var d1 = new ActionDescriptor();
    var r = new ActionReference();
    r.putProperty(s2t("channel"), s2t("selection"));
    d.putReference(s2t("null"), r);
    d1.putUnitDouble(s2t("top"), s2t("pixelsUnit"), top);
    d1.putUnitDouble(s2t("left"), s2t("pixelsUnit"), left);
    d1.putUnitDouble(s2t("bottom"), s2t("pixelsUnit"), bottom);
    d1.putUnitDouble(s2t("right"), s2t("pixelsUnit"), right);
    d.putObject(s2t("to"), s2t("rectangle"), d1);
    executeAction(s2t("set"), d, DialogModes.NO);
}

 

The solution is not ideal, since Photoshop does not provide us information about the sizes of the service interface elements - rulers and scroll bars, and they fall into the selection zone, but in general the script does exactly what you asked.

Translate
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