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

Can Someone Explain What This Means.

Participant ,
Nov 11, 2017 Nov 11, 2017

Copy link to clipboard

Copied

Looking at the Script-listener log, the first part of an action shows the following

function step1(enabled, withDialog) {

    if (enabled != undefined && !enabled)

    return;

Can anyone briefly explain what is happening in these 3 lines please

TOPICS
Actions and scripting

Views

495

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 , Nov 11, 2017 Nov 11, 2017

Line one is your function, and it has two values that are passed to it: enabled and withDialog. I don't know what is being checked or how it's being checked for the enabled part, but it should be a true/false value.

Line two checks to see if the value enabled has any value at all or is false. The ! is used as a negative, so !enabled is seeing if enabled is not true. the != undefined checks to see if enabled has a value at all. I'm not sure you really need that. just a if(!enabled) should work.

Lin

...

Votes

Translate

Translate
Adobe
Community Expert ,
Nov 11, 2017 Nov 11, 2017

Copy link to clipboard

Copied

Line one is your function, and it has two values that are passed to it: enabled and withDialog. I don't know what is being checked or how it's being checked for the enabled part, but it should be a true/false value.

Line two checks to see if the value enabled has any value at all or is false. The ! is used as a negative, so !enabled is seeing if enabled is not true. the != undefined checks to see if enabled has a value at all. I'm not sure you really need that. just a if(!enabled) should work.

Line 3 just tell the script to stop the function and return to the main script. if you had something after the return, it would return that value.

I hope that's what you mean my wanting to know what those 3 lines do.

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
Participant ,
Nov 11, 2017 Nov 11, 2017

Copy link to clipboard

Copied

Thanks Chuck, that has answered my question, it was the != undefined I was not sure about

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 ,
Nov 11, 2017 Nov 11, 2017

Copy link to clipboard

Copied

LATEST

Yea, like I said, I don't think that's really necessary, but if just the !enabled doesn't always work, you can add that back in.

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