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

Check the width of the document and do something!

Contributor ,
Mar 01, 2018 Mar 01, 2018

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
1.1K
Translate
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

     }

Translate
Adobe
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

     }

Translate
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

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

Translate
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
LATEST

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

Translate
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

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.

Translate
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