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

How to call "Fit to Screen" in UXP JavaScript?

Contributor ,
Jul 06, 2021 Jul 06, 2021

Copy link to clipboard

Copied

Is there any way to use Zoom Fit to Screen (same as Ctrl+0) in UXP scripting?

 

In CEP/ExtendScript, we can use as following.

app.runMenuItem(app.charIDToTypeID("FtOn"));
// Fit to Screen (same as Ctrl+0)

 

It seems not implemented simiar way on Photoshop UXP DOM as 

require('photoshop').app.runMenuItem(1182027630);

 

Result:

ss_20210706_143909_019.png

 

From UXP Alchemist plugin's ScriptListner is showing:

{
  "_obj": "invokeCommand",
  "commandID": 1192,
  "kcanDispatchWhileModal": true,
  "_isCommand": false
}

 

From batchPlay(), above seems not runnable (this part is not quite sure).

    var result = require('photoshop').action.batchPlay([
        {
            "_obj": "invokeCommand",
            "commandID": 1192,
            "kcanDispatchWhileModal": true,
            "_isCommand": false
        }
    ], {synchronousExecution: true});

 

Result:

ss_20210706_144233_020.png

 

I'm not quite sure if above is proper usage of batchPlay() as well.

But is there any way to use Zoom Fit to Screen (same as Ctrl+0) in UXP scripting?

 

Thank you,

Naoki

TOPICS
Actions and scripting , SDK , Windows

Views

964

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
LEGEND ,
Jul 06, 2021 Jul 06, 2021

Copy link to clipboard

Copied

Votes

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
Contributor ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

haha, one of those again. 😄

Votes

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
LEGEND ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

btw I found now your unposted answer to me: Jun 29, 2021 🙂

Votes

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
Contributor ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

Hi @Kukurykus 

 

Thank you very much for reply.

 

But your series of links does not make any sense.

If you know the answer of my question, please post here.

 

Thank you,

Naoki

 

Votes

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
LEGEND ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

At end of those links path you find dedicated UXP forum 😉

Votes

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
Contributor ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

@Kukurykus 

You mean this post and following link.

How to select multiple layers with UXP

Photoshop UXP Plugin API

I don't think this is correct answer to the question even marked.

Also does not make any sense to this question too.

Votes

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
LEGEND ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

Yes, that what I mean. It's not correct answer indeed, but it leads you to proper forum where you can get replies related to Unified Extensibility Platform. Here is Ps ExtendScript forum.

Votes

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 14, 2021 Jul 14, 2021

Copy link to clipboard

Copied

I believe this is Photoshop general forum and not limited to ExtendScript, which is getting depricated. UXP is already included in Photoshop 2021 as main feature. So I think asking UXP question in this forum should be no issue.

Votes

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
LEGEND ,
Jul 14, 2021 Jul 14, 2021

Copy link to clipboard

Copied

LATEST

You can ask of course, but from linked topics you'll see there never was even one answer 🙂

 

btw. does Naoki-Hada belong to you. If so why do you different (however similar) accounts?

Votes

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
Advocate ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

That code you put ("invokeCommand")
and photoshop junk
ScriptingListener does not record fit to screen
you should do it by action

try this little code if it works

 

if (documents.length!=0) {runMenuItem(app.charIDToTypeID("FtOn"));}

Votes

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
Contributor ,
Jul 07, 2021 Jul 07, 2021

Copy link to clipboard

Copied

Hi @Geppetto Luis 

 

Thank you very much for your reply.

I know the limitation, that's why I'm asking this question.

Your code is ExtendScript and about same as my 4th line of question.

It does not work on UXP JavaScript, so I'm asking this question.

If you know working UXP code, please let me know.

 

I'm converting working CEP/ExtendScript code to UXP plugin.

This part is one of the blocker.

 

Ref. about Listner on UXP

Adobe UXP: Things you need to know! #6 BatchPlay (part 1): the ActionManager roots

 

Thank you,

Naoki

 

Votes

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