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

Problem with colour assignment

Community Expert ,
Jun 12, 2019 Jun 12, 2019

Copy link to clipboard

Copied

Friends and experts,

I have this short piece of code (within function Fgr_BtnAssign) which I try to debug, because results are really odd:

  // only either of these two is set (localised colour names)

  sColour = wPalP.g0.pLine.g3.ddlColourStd.selection.text +

            wPalP.g0.pLine.g3.ddlColourUser.selection.text;

alert ("«" + sColour + "» " + typeof sColour);

  if (sColour = "") { return;}                    // mis-selection

//sColour = "Pale Green";

  oColour = oDoc.GetNamedColor(sColour);          // try to assign

alert ("«" + sColour + "»");

  if (oColour.ObjectValid()) {

    oObject.Color = oDoc.GetNamedColor(sColour);

  } else {

    msgText = "Can not set colour «" + sColour + "»";

  }

Alert in line 04 says «Pale Green» string

Alert in line 08 says «» which is an empty string.

Hence GetNamedColor has destroyed it's argument what I have never seen before. Of course no colour is assigned and I get an error indication.

When directly assign a colour string in line 06, there is no problem...

ESTK mingled up? âž” reboot âž” nothing changed.

Well, it's time to perpare lunch anyway...

Klaus

TOPICS
Scripting

Views

923

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

Enthusiast , Jun 12, 2019 Jun 12, 2019

Simple answer:

you assign a new value in line5

Change it from if (sColour = "") to if (sColour == "")

Votes

Translate

Translate
Enthusiast ,
Jun 12, 2019 Jun 12, 2019

Copy link to clipboard

Copied

Simple answer:

you assign a new value in line5

Change it from if (sColour = "") to if (sColour == "")

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 ,
Jun 12, 2019 Jun 12, 2019

Copy link to clipboard

Copied

Well, it would not help to bang my head until becaming flat. This is simply the type of error I can not spot anymore - hence pauses are the only cure to get a fresh look - and friends like You who do not hesitate to look at such stupid code...

Thank You!!!!

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
Enthusiast ,
Jun 12, 2019 Jun 12, 2019

Copy link to clipboard

Copied

LATEST

Hi Klaus,

Boys our age should take a nap from time to time 😉

That's just what I'm gonna do right now.

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