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

select document 1

Enthusiast ,
Jan 17, 2025 Jan 17, 2025

I always use many open documents
from 3 to 10 documents
I need a script that immediately selects the first one as in the figure.
I tried to make an action, but it takes into account the open documents,
so when I create the action that has 3 open documents and then I want to use it when I have 6, it doesn't work.

do you have any idea how to proceed

Schermata 2025-01-17 alle 17.14.12.png

TOPICS
Actions and scripting
519
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

correct answers 1 Correct answer

Community Expert , Jan 17, 2025 Jan 17, 2025
quoteI need a script that immediately selects the first one as in the figure.

 


By @Ciccillotto

 

Not sure about UXP .psjs, however, in legacy ExtendScript .jsx:

 

app.activeDocument = app.documents[0];
Translate
Adobe
Community Expert ,
Jan 17, 2025 Jan 17, 2025
quoteI need a script that immediately selects the first one as in the figure.

 


By @Ciccillotto

 

Not sure about UXP .psjs, however, in legacy ExtendScript .jsx:

 

app.activeDocument = app.documents[0];
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
Enthusiast ,
Jan 17, 2025 Jan 17, 2025

It worked fine in uxp Thanks for your help

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
Community Expert ,
Jan 18, 2025 Jan 18, 2025

You're welcome, there is some crossover in ES vs. UXP DOM, but it's not my default expectation that things are 1:1 so I wasn't sure without checking.

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
Enthusiast ,
Jan 18, 2025 Jan 18, 2025

Some things work, some don't, some aren't usable.

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
Community Expert ,
Jan 18, 2025 Jan 18, 2025
LATEST
quote

Some things work, some don't, some aren't usable.


By @Ciccillotto

 

In the ES DOM, both of these are valid:

 

var theDoc = app.activeDocument;
//or
var theDoc = activeDocument;

 

While in the UXP DOM, one can't omit the root app. path:

 

let theDoc = app.activeDocument;

 

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