How to automatically run a script Vertical image & Horizontal image

Community Beginner ,
Jul 01, 2022 Jul 01, 2022

Copy link to clipboard

Copied

Hi all,
I'm not good at scripting, but I'm having trouble with my work and if someone can help me to make things more convenient then that's fine.

 

Vertical image- run script A
Horizontal image - run script B

 

Any help will be appreciated. Thanks very much!

TOPICS
Actions and scripting

Views

51

Likes

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

Adobe Community Professional , Jul 01, 2022 Jul 01, 2022
Add conditional actions This can be done without a script - just write a condition to the action and assign a command that it will execute for each case (if you need to run a script, you can easily write it into an action)

Likes

Translate

Translate
Adobe Community Professional ,
Jul 01, 2022 Jul 01, 2022

Copy link to clipboard

Copied

Insert the necessary code in the respective clause instead of running the Actions. 

// 2012, use at your own risk; 
#target photoshop
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
if (myDocument.width > myDocument.height) {
	app.doAction("Canvas landscape", "bfunk")
	}
else {
	app.doAction("Canvas portrait", "bfunk")
	}
};

 

Likes

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 Professional ,
Jul 01, 2022 Jul 01, 2022

Copy link to clipboard

Copied

LATEST

Add conditional actions

 

This can be done without a script - just write a condition to the action and assign a command that it will execute for each case (if you need to run a script, you can easily write it into an action)

 

2022-07-01_13-59-15.png

2022-07-01_13-59-50.png

Likes

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