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

changing paragraph attributes cancellation

Participant ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

This is a minor problem for what i am currently doing but it irritates me and in other applications it would be a much bigger problem.

I am changing paragraph attributes but only the last change works. Below i am changeing the spaceBefore and After in a paragraph.

If i change spaceBefore then spaceAfter then only spaceAfter will be changed. if I switch them so spaceBefore is last then only spaceBefore will be changed.

#target "illustrator"   

var active_doc = app.activeDocument;

var text_frames = active_doc.textFrames;

var this_text_frame = text_frames[0];

with (this_text_frame.textRange.paragraphAttributes){

      spaceBefore = 0

      spaceAfter = 0

}

What is happening here?

Thanks.

Dane

TOPICS
Scripting

Views

604

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
Adobe
Community Expert ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Hi daneJ,

this snippet works well for me

var aDoc = app.activeDocument;

var aTF = aDoc.textFrames[0];

aTF.textRange.spaceBefore = 15;

aTF.textRange.spaceAfter = 30;

Every paragraph gets the spaces.

(But be sure: IMO the first paragraph does not show a visible spaceBefore in his text frame, only the value in the options)

Have fun

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 ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Hi Pixxxel schubser

Thanks for the response. I tryed this out exactly as you wrote it and it worked. However if your textFrame already has a spaceBefore/After value higher than 0 and you would like to return both values to 0, this is where the problem arises.  spaceBefore = 0; spaceAfter = 0. the first line is carried out but the second line is ignored.

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 ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Plaese give an example file or screenshots what you have done.

I havn't problems:

1) before running the script snippet:

spaceBefore_After_0.png

2) after running the script snippet:

spaceBefore_After_1.png

3) change back with values = 0:

spaceBefore_After_2.png

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 ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Hi again,

here are the screenshots.

1. BEFORE.

2. AFTER

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 ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Works well for me too (with more text frames)

After running with values 3 and 4

spaceBefore_After_3.png

change back with value = 0

spaceBefore_After_4.png

Sollte niemand anderes mitschreiben: Können wir in Deutsch weiterschreiben? Hast du eine Beispieldatei mit Illustrator-Versionsangabe (z.B. Dropbox oder Xup.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
Participant ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Meine Muttersprache ist Englisch aber ich kann deutsch und wenn das angenehmer ist dann gerne.

Ich arbeite mit der Aktuellen Illustrator CC 2018.

Unten ist ein Link mit meiner Testdatei.

WeTransfer

Vorgestern hatte ich auch so einen Fall. Dafür fand ich eine Work Around die aber nicht hier helfen kann.

Ich hatte ein TextFrame in dem ich mit .Replace Daten ersetz habe und danach akiRight bei einem character geändert.

Später in dem Code war noch was in dem selben Frame geändert und dadürch war meine akiRight Anweisung zurückgesetzt.

Macht kein Sinn.

Spielst du den Code von Extend-Script aus?

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 ,
Dec 06, 2017 Dec 06, 2017

Copy link to clipboard

Copied

Dein Deutsch ist besser als mein Englisch.

Aus reiner Neugier: Wieso nutzt du die deutschsprachige Benutzeroberfläche?

Ok. Danke für deine Beispieldatei.

Das Gute ist, dass ich dein Problem jetzt nachvollziehen konnte.

Schlecht ist, dass nach dem Öffnen deiner Datei mein Script jetzt weder in deiner Datei, noch in meinen neuangelegten Testdateien funktioniert. Die Ursache dafür ist mir (hoffentlich) noch schleierhaft. Denn vorher funktionierte alles korrekt und genau so wie es funktionieren sollte. Vielleicht ist der Zeilensetzer die Ursache - der steht jetzt immer auf benutzerdefiniert. Nutzt du vielleicht den globalen Setzer? Ich arbeite nur mit einem deutschen Illustrator. Dort gibt es den globalen Setzer nicht.

Den Code habe ich sowohl aus dem ESTK heraus gestartet als auch aus Illustrator heraus. Das Ergebnis war jeweils gleich.

Ich weiß nicht, ob ich die Ursache finden werde. Das würde wahrscheinlich mehr Zeit erfordern, als ich gerade zur Verfügung habe. Aber wer weiß …

Viele Grüße

pixxxel schubser

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 ,
Dec 07, 2017 Dec 07, 2017

Copy link to clipboard

Copied

LATEST

Danke schonmal für deine Mühe

Es bewundert mich immer wieder wie hilfsbereit  Leute in diesem Forum sind.

Ja, vielleicht am Zeilensetzer liegt das. Ich hab ein bißchen rum gegraben ob ich ein Variable dafür finden könnte. Kein Erfolg.

Also wie am Anfang erwahnt ist das ärgerlich aber nur eine Kleinigkeit. Ich kann aber vorstellen dass in einem anderen Project, sowas kritisch werden könnte. Mal schauen.

Vielen Dank.

Ich habe nicht eine deutschsprachige Benutzeroberfläche weil ich mich gern herausfördern möchte, das kann ich schonmal sagen. Bei einer deutschen Firme im schönen Rurhgebeit arbeite ich. Einsteigen auf eine deutsche Illustrator Version war eine Qual aber mitteleweile bin ich ahnungslos auf einer englischen Version geworden.

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