🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #1259

CS2 script not working in CS3

#1259
From: thiyagus5
Date: Fri, 13 Feb 2009 07:26
72 lines
2945 bytes
Hi scriptwriters,

We are currently working for book index in InDesign CS3. Before we were added the index topics, references to the documents in InDesign CS2 through java script. Now we are trying to use the same script for InDesign CS3. While running the script it shows some error in "text searching". I know that searching method is entirely different from CS2 to CS3. I have tried to solve the script error by modifying the script according to CS3 find text preferences. But I am not able to solve the error, so I have copied the pure CS2 script below. Please find the script below and help me for this by modifying it.

//IndexFromArrayList_withOneSubtopic

var level=0;
try{
for(k=0; k<app.documents.length; k++) { var myDoc = app.documents[k]; var arr = new Array(), x=0, j=0, i=0; arr = []; arr = ["acceptance", "action", "activity", "Adam and Eve"]; var myI, myT, myPRf;

level=0;
alert(k+1);
myI = myDoc.indexes.add();

for(i=0;i<arr.length;i++) { 	x = myDoc.search(arr[i],false,false,arr[i]); 	if((x.length>0)&(x.length>j))
	{
		myT = myI.topics.add(arr[i]);
		myPRf = myT.pageReferences.add(x[j]);
		j++; i--;
	}
	else
		j=0;
	}

//second - level
level=1;
alert(k+1);

arr=[];
arr = ["action|vs. desire", "action|agitated", "action|see also karma", "activity|and diseases", "activity|and neuroses", "activity|internal and external"];

for(j=0,i=0;i<arr.length;i++) { 	x1 = arr[i]; 	x1 = x1.split("|"); 	x = myDoc.search(x1[1],false,false,x1[1]); 	if((x.length>0)&(x.length>j))
	{
		try
		{
		 myT = myI.topics.item(x1[0]);
		 myT1 = myT.topics.add(x1[1]);
		}
		catch(e)
		{
		 continue;
		}
		myPageRef = myT1.pageReferences.add(x[j]);

		y = x1[1];
		y = y.substring(0,8);
		if(y == "see also")
		 myPageRef.pageReferenceType = PageReferenceType.suppressPageNumbers;
		else
		 myPageRef.pageReferenceType = PageReferenceType.currentPage;

		j++; i--;
		}
	else
		j=0;
		}
	}
}
catch(e)
{
	alert(e);
	alert(myDoc.name);
}

//------------------------------

Here the sample text to test the script;

The even action feuguercing erit acceptance velit adipis activity nisim and diseases nullupt atincin utpat agitated ut inismodigna Adam and Eve augue dolortie et lut volor si ea faccummodit and neuroses nonulla mconulla internal and external commod eugueros aliquat wisisi.

Thanks in advance
Thiyagu
Technical Details
Message-ID: <59b7e6e9.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,9ae722dc965ca6d8,start
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: thiyagus5@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: CS2 script not working in CS3
Message-ID: <59b7e6e9.-1@webcrossing.la2eafNXanI>
Date: Thu, 12 Feb 2009 23:26:07 -0800
Lines: 99
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit