Highlighted

if the named channel exists it does one thing if it doesn't exist it does another

Advocate ,
Oct 10, 2020

Copy link to clipboard

Copied

I have a channel named test
if the channel exists a warning must say ok
if the channel does not exist a warning that says ko.

 

Adobe Community Professional
Correct answer by r-bin | Adobe Community Professional
try { app.activeDocument.channels["test"]; alert("ok"); } catch(e) { alert("ko"); }
TOPICS
Actions and scripting

Views

114

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

if the named channel exists it does one thing if it doesn't exist it does another

Advocate ,
Oct 10, 2020

Copy link to clipboard

Copied

I have a channel named test
if the channel exists a warning must say ok
if the channel does not exist a warning that says ko.

 

Adobe Community Professional
Correct answer by r-bin | Adobe Community Professional
try { app.activeDocument.channels["test"]; alert("ok"); } catch(e) { alert("ko"); }
TOPICS
Actions and scripting

Views

115

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
Oct 10, 2020 0
Most Valuable Participant ,
Oct 10, 2020

Copy link to clipboard

Copied

And what exactly are you asking? A script? An action? How is it supposed to be used? You need to be much more specific and provide a proper explanation instead of vomitting bullet points.

 

Mylenium

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
Reply
Loading...
Oct 10, 2020 1
Adobe Community Professional ,
Oct 10, 2020

Copy link to clipboard

Copied

This is taken out of context. Unfortunately not first time.

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
Reply
Loading...
Oct 10, 2020 1
Advocate ,
Oct 11, 2020

Copy link to clipboard

Copied

r-bin
You are always the best.

Kukurykus
True, I'm not always specific in asking questions
the point is this;
how come r-bin always understands me and you never understand me?

 

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
Reply
Loading...
Oct 11, 2020 0
Adobe Community Professional ,
Oct 11, 2020

Copy link to clipboard

Copied

To let others understand what you want you should describe situation like for ex.: "I have an open document, I run the script and then I want to get to know if in document the channel named "test" exists or not".

 

Without above it's unclear what you want, because checking named channel is so simple & obvious task in scripting that taking in consideration a long time you attend on this forum it is unbelivable you may ask about such basic stuff, like:

 

"If document is open then alert says 'open', if not, then 'not open'", really?

 

alert(!documents.length ? 'closed' : 'open')

 

Now you understand I don't get you might want common and after all searchable thing on this forum. That doesn't need to create new topic. So what I looked for was the situation, the named channel was part of, not solely how to check 'if the hole is for door or window'.

 

Regarding r-bin, probably he learned after years your specific way of thinking, so knowing that, it was easy to him to approach to you individually, to get what's in your mind 😉

 

btw yestarday your thread was next to Histogram passed and drawn into a Layer. Done!, where from it's easy to figure out how to check name of channel. 

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
Reply
Loading...
Oct 11, 2020 0
Advocate ,
Oct 11, 2020

Copy link to clipboard

Copied

Kukurykus
You are right
it is I who am wrong to express myself and put the question correctly, you have told me several times that I have to ask the question in the right way
I thank you for the help you always give me.

r-bin can understand me because it has been following me for so long
and teaches me a lot
I'll never stop thanking him for everything he does.

 

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
Reply
Loading...
Oct 11, 2020 1
Adobe Community Professional ,
Oct 10, 2020

Copy link to clipboard

Copied

try { app.activeDocument.channels["test"]; alert("ok"); } catch(e) { alert("ko"); }

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
Reply
Loading...
Oct 10, 2020 1