Extendscript:Photoshop脚本IF activedocument正确的语法

问题描述 投票:-1回答:1

我有问题尝试做以下事情。它一直停在return属性处。谢谢!我想要检查各种文件名,然后更改这些值的输出.. thx。

  if (activeDocument.search("160x600")>0)
    {
        if (activeDocument.search("300x600")>0)
        {
           path: activeDocument.path,
           maxSize: 59 //size in kbs
           return
        };
        saveJPG(
        {
            path: activeDocument.path,
           maxSize: 39 //size in kbs
        });  
javascript photoshop extendscript
1个回答
0
投票

(从你的other post获取数字,你可能想要这样的东西:

if (activeDocument.name.search("160x600")>0)
    {
    maxSize: 39
    }

else if (activeDocument.name.search("300x600")>0)
    {
    maxSize: 59
    }

else if (activeDocument.name.search("1500x513")>0)
    {
    maxSize: 150
    }

else
    {
    alert ('document not saved')

    }

之后,您可以调用saveJPG函数,传递已选择的maxSize值

© www.soinside.com 2019 - 2024. All rights reserved.