how to use if conditional function in script

Community Beginner ,
Mar 03, 2022 Mar 03, 2022

Copy link to clipboard

Copied

i create an action  Auto fill images in frames, its workign fine, but , now i want this action convert into script, in this action  i use" if conditional" method use, but when i play script if conditional function not working. . how to solve this problum. 

script (part)

 


// If
function step2(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
desc1.putEnumerated(cTID('null'), cTID('Cndt'), cTID('Bckg'));
var ref1 = new ActionReference();
ref1.putName(cTID('function'), "Action 2");
ref1.putName(cTID('ASet'), "Auto Set 1");
desc1.putReference(cTID('then'), ref1);
var ref2 = new ActionReference();
ref2.putName(cTID('function'), "Action 1");

desc1.putReference(cTID('else'), ref2);
executeAction(sTID('conditional'), desc1, dialogMode);
};


//Action 1

function Action1() {
// Set
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID('Chnl'), sTID("selection"));
desc1.putReference(cTID('null'), ref1);
desc1.putEnumerated(cTID('T '), cTID('Ordn'), cTID('Al '));
executeAction(cTID('setd'), desc1, dialogMode);
};
}

TOPICS
Actions and scripting , Cross-app workflows , SDK , Windows

Views

35

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
LEGEND ,
Mar 03, 2022 Mar 03, 2022

Copy link to clipboard

Copied

LATEST

First of all paste codes using </> icon to not let forum wipe out extra spaces, second, call the created functions.

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