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

Can Someone Explain What This Means.

Contributor ,
Nov 11, 2017 Nov 11, 2017

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
678
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 , 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

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

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.

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

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

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

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