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

Need help to build Simple Script

New Here ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

Hello,

 

First off I am working on Mac. I have 1000's of files on photoshop that need the same exact redundant manual task.

I need help building 2 seperate scripts. 

 

1st Script, need to make sure there is only 1 layer in the Layers window.

2nd Script, Need to check for a single path. 

 

I have zero coding exprience and have been frantically been looking around the web for a copy paste script but I have no idea how to excute that. I have tried the actions panels but it is very limited. 

 

I am using Script Editor if there is a better app to use for scripting I welcome that. 

 

Thank you

TOPICS
Actions and scripting , macOS

Views

181

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
Community Expert ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

Your requirements are not crystal clear.

 

1) There is a conditional action to check for whether an image has layers (1 or more) or is flattened with a special Background layer, which technically is a single layer, but this may not meet your criteria?

 

conditional.png

 

2) Conditional actions don't include paths, so you would need a script for this one anyway.

 

It is easy enough to script a warning/alert when opening a document (Script Events Manager ) if it contains > 1 layer or path, however, if you want automation to actually "do something" then more info would be required.

 

If you are using Apple ScriptEditor, then don't use it for Adobe JavaScript, more here on editors:

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

if (activeDocument.layers.length > 1) {
    alert("There is more than 1 layer!");
}

 

Note: An empty layer set/group counts as a layer with the simple code above.

 

if (activeDocument.pathItems.length > 1) {
    alert("There is more than 1 path!");
}

 

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 ,
May 12, 2022 May 12, 2022

Copy link to clipboard

Copied

LATEST

For the only one layer in document unless you mean also layers in layer set.

!(activeDocument.layers.length - 1)

 

For checking existence of following file on desktop:

File('~/desktop/someFile.psd').exists

 

ExtendScript Debugger

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