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

Check the width of the document and do something!

Contributor ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Hi friends, good night

Here's another hard question for experts:

I have dozens of images with the most varied sizes ranging from 8 to 20 cm wide by 9cm high and they will have to be added in 3 masks according to their respective size: How to automate this!

Maybe a script that can check the width of the document and perform a specific function!

Example:

If the active document has a width between 8 to 10 cm,  execute function 1. "Mask 1"

/////////////

If the active document has a width of 12 to 14 cm, execute function 2. "Mask 2"

////////////

If the active document has a width between 19 to 20 cm,  execute function 3. "Mask 3"

Grateful for the attention

TOPICS
Actions and scripting

Views

818

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

correct answers 1 Correct answer

Community Expert , Mar 01, 2018 Mar 01, 2018

var doc = activeDocument;

if(doc.width>=8&&doc.width<=10){

     //code here

     }

else if(doc.width>=12&&doc.width<=14){

     //code here

     }

else if(doc.width>=19&&doc.width<=20){

     //code here

     }

else{//code to capture all other widths

     }

Votes

Translate

Translate
Adobe
Community Expert ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

var doc = activeDocument;

if(doc.width>=8&&doc.width<=10){

     //code here

     }

else if(doc.width>=12&&doc.width<=14){

     //code here

     }

else if(doc.width>=19&&doc.width<=20){

     //code here

     }

else{//code to capture all other widths

     }

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 Expert ,
Mar 02, 2018 Mar 02, 2018

Copy link to clipboard

Copied

In the simplest form, the //code here line could be replaced with:

app.doAction("My Action","My Action Set.atn")

Another alternative but similar option could be:

Siva's Photoshop Conditional Action

http://sivaratnam.googlepages.com

Download Siva's Photoshop Conditional Action

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 ,
Mar 02, 2018 Mar 02, 2018

Copy link to clipboard

Copied

LATEST

Stephen_A_Marsh this is too interesting! It will be very useful. Thanks for the tip.

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 ,
Mar 02, 2018 Mar 02, 2018

Copy link to clipboard

Copied

Phenomenal it! How wonderful it worked perfectly well. Beautiful work.

Thank you one more timeChuck Uebele!

When I grow up I want to be just like you.

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