Adobe Photoshop UXP:如何在 UXP JavaScript 中调用“适合屏幕”?

问题描述

我正在将工作 CEP/ExtendScript 转换为 UXP JavaScript。

有什么方法可以在 UXP 脚本中使用 Zoom Fit to Screen(与 Ctrl+0 相同)?

在 CEP/ExtendScript 中,我们可以这样使用。

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

它似乎没有在 Photoshop UXP DOM 上实现类似的方式

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

结果:

enter image description here

来自 UXP Alchemist 插件的 Listner 显示

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

从batchPlay()来看,上面似乎不能运行(这部分不太确定)。

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

结果:

enter image description here

我不太确定上面是否也正确使用了 batchPlay()。

但是有没有办法在 UXP 脚本中使用缩放适合屏幕(与 Ctrl+0 相同)?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)