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

How to write in jsx "Not equal"?

Explorer ,
Apr 11, 2013 Apr 11, 2013

Copy link to clipboard

Copied

i need to check, if all bleeds have the same value:

with (app.activeDocument.documentPreferences){

if (documentBleedBottomOffset==documentBleedTopOffset==documentBleedInsideOrLeftOffset==documentBleedOutsideOrRightOffset){

alert ("Make bleeds equal!"); exit()

}}

But if i try:

if (!documentBleedBottomOffset==documentBleedTopOffset==documentBleedInsideOrLeftOffset==documentBleedOutsideOrRightOffset){

nothing changes: line "alert" executes anyway. Why?

TOPICS
Scripting

Views

2.2K

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
Enthusiast ,
Apr 11, 2013 Apr 11, 2013

Copy link to clipboard

Copied

'me' != 'you' //-> true

Edit:

Google loves us: http://www.w3schools.com/js/js_comparisons.asp

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
Guru ,
Apr 11, 2013 Apr 11, 2013

Copy link to clipboard

Copied

Why don't you test the boolean… documentBleedUniformSize

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 ,
Apr 11, 2013 Apr 11, 2013

Copy link to clipboard

Copied

Muppet, you almost got me! But Bleed can be the same, even if the 'Make all settings the same' "checkbox" is not selected.

Dmitry, the proper syntax for "not x" is indeed "!x". But you need to use it on your entire expression:

if (!(documentBleedBottomOffset==documentBleedTopOffset==documentBleedIns ideOrLeftOffset==documentBleedOutsideOrRightOffset)) ...

-- note the extra set of parentheses.

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
Explorer ,
Apr 11, 2013 Apr 11, 2013

Copy link to clipboard

Copied

Dmitry,

I did some experimenting on the console like so:

5==5==5==5

believe it or not, this came out false and that's because the first 5==5 was evaluated to true or 1 so the second comparison was actually 1==5 which was evaluated to false, or 0, and so on.

Interestingly enough, !5==5==5==5 in the console window was evaluated as false as well.  It wasn't until I did this:

!(5==5==5==5)

that the expression was evaluated as true.  That's because the internal expression was evaluated as false and the ! operator essentially flips the value to its opposite.

I think you want to refine your evaluation to something like this:

a = 11;

b = 10;

c = 10;

d = 10;

if(!(a == b && b == c && c == d))  //should evaluate to true

R,

John

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
Explorer ,
Apr 12, 2013 Apr 12, 2013

Copy link to clipboard

Copied

LATEST

Yes! Only this:

if(!(a == b && b == c && c == d))

does work properly.

Thanks, John.

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