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

textFrames.add({strokeweight:0}) is not working properly in indesign CS5 Win Xp

Enthusiast ,
Nov 06, 2011 Nov 06, 2011

Hi EveryOne,

I am using the below line in my script,

myFrame = myDoc.pages[1].textFrames.add({strokeWeight:"0pt"});

It is creating a text frame, but with 1pt stroke weight. While i'm checking in the data browser it says "The property is not applicable in the current state".

But when I alert the (myFrame.strokeWeight) it alerts with the correct value.

My Work Around: (Still it is Bad)

Then I changed the code

myFrame = myDoc.pages[1].textFrames.add({strokeWeight:"0pt"});

myFrame.strokeWeight = 0;

Then it works for me. The problem is I have to give the stroke values in two places, If I remove any one of them, then my code is not working properly.

Please help me to overcome this issue....

----

Green4ever

TOPICS
Scripting
3.7K
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
LEGEND ,
Nov 06, 2011 Nov 06, 2011

Green:

  The Data Browser is not reliably. In particular, if you have not accessed myFrame's properties, The ESTK does not have access to the DOM object details unless you access some properties of myFrame. So this behavior of the data browser is not surprising, and I am not sure that it is releant to your problem.

What happens if you use "0" rather than "0pt"? Or, for that matter, 0 (not a string)? Or the strings "0p0" or "p0"?

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
Enthusiast ,
Nov 07, 2011 Nov 07, 2011

Hi John,

What happens if you use "0" rather than "0pt"? Or, for that matter, 0 (not a string)? Or the strings "0p0" or "p0"?

Note: I have set the preferences to pt

I've tried using both string representation "0" and "0pt" and also tried  0 (not a string). None of them is not worked for me...

---

Green4ever

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
Guide ,
Nov 07, 2011 Nov 07, 2011

Hi Green4ever,

[Sorry, it's not the right code. I can't test now]

I guess that {strokeColor:'none'} supersedes {strokeWeight:0}. Try this:

myFrame = myDoc.pages[1].textFrames.add({strokeColor:'None'});

@+

Marc

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
Enthusiast ,
Nov 08, 2011 Nov 08, 2011

Hi Marc Autret,

May be You are right....

myFrame = myDoc.pages[1].textFrames.add({strokeColor:"None",strokeWeight:0});

This Code worked for me...

---

Green4ever

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 08, 2011 Nov 08, 2011

But with Marc's code:

myFrame = myDoc.pages[1].textFrames.add({strokeColor:"None",strokeWeight:0})

the stroke weight is still the standard 1 pt (or whatever it is). For Marc's solution to work well, you should set the stroke weight to 0.00000001 pts, which is as thin as you can get it.

Peter

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
Enthusiast ,
Nov 08, 2011 Nov 08, 2011
LATEST

Hi Peter and Laubender,

the stroke weight is still the standard 1 pt (or whatever it is). For Marc's solution to work well, you should set the stroke weight to 0.00000001 pts, which is as thin as you can get it.

If you give stroke color and stroke weight together it works fine.

As Marc Autret said, beacuse of stroke color value it takes a deafult strokeweight value. (I think this may be a cause)....

I guess that {strokeColor:'none'} supersedes {strokeWeight:0}.

Thanks,

Green4ever

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 07, 2011 Nov 07, 2011

Green4ever:
Use strokeColor and strokeWeight together.

myFrame = myDoc.pages[1].textFrames.add({

strokeColor:"None",

strokeWeight:0

});

I think your problem stems from the default object style [Basic Text Frame] automatically applied to every new text frame. So check the properties there.

Uwe

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
Enthusiast ,
Nov 08, 2011 Nov 08, 2011

Hi Laubender,

The default object style [Basic Text Frame]'s stroke weight is set to zero. Eventhough your sugestion worked for me. Thank U....

-Green4ever

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 08, 2011 Nov 08, 2011

Hi Green4ever,
If it's not [Basic Text Frame], I wonder why that will happen…
Do you have an idea?

Uwe

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 07, 2011 Nov 07, 2011

I had the same problem.

Try this:

app.documents.item(0).pageItemDefaults.strokeWeight=0;

And check that you do not have a default objectstyle with strokeWeight 0

Ralf

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
Enthusiast ,
Nov 08, 2011 Nov 08, 2011

Hi liedzeit,

I tried your suggestion it didnot work.

And check that you do not have a default objectstyle with strokeWeight 0

Yeah I checked in the default object style stroke weight is set to zero.

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