🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8507

Re: Applying script changes character/paragraph style?

#8507
From: Linda_Ni
Date: Fri, 06 Oct 2006 22:58
44 lines
1856 bytes
Oh, I see.

What I did was:

1. Look at the new document.
2 The document already contains the necessary texts with the applied styles.
3. Set max number of characters allowed.
4. Count the number of characters in the textbox.
5. If it exceeds max amount, add carriage return at the comma.

The code looks something like this:

{
   newDocument = app.activeDocument;
   myField = newDocument.textFrames.item("Section_1");

if(myField == null)
     {
	"textFrame is empty."
     }
     else
     {
	var myString = new String();
	myString = myField.toString();
	var max = 23;
	addCarriageReturn(max, myString);
     }
}

function addCarriageReturn(iMaxLength, sValue)
{
     if (sValue.length > iMaxLength)
     {
	alert(sValue.length);
	sValue = sValue.replace(",",",/r", sValue);
     }
     return sValue;
}

I know the code doesn't work, and I still have trouble on the coding because I am new at this. I had the problem of the whole character/paragraph style being removed the last time I tried to do something.

Thanks again!

Linda
Technical Details
Message-ID: <3bc1e4a7.3@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.albasani.net!news.musoftware.de!newsfeed.x-privat.org!spool.x-privat.org!webcrossing
References: <3bc1e4a7.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,fe9ac4a084ef676a
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Linda_Ni@adobeforums.com
Newsgroups: adobe.scripting.indesign
Subject: Re: Applying script changes character/paragraph style?
Message-ID: <3bc1e4a7.3@webcrossing.la2eafNXanI>
Date: Fri, 6 Oct 2006 15:58:12 -0700
References: <3bc1e4a7.-1@webcrossing.la2eafNXanI>
Lines: 47
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.albasani.net!news.musoftware.de!newsfeed.x-privat.org!spool.x-privat.org!webcrossing