Article View: adobe.scripting.indesign
Article #14794Re: [VB] Tough nut to crack, generate an index
From: Raymond_Messier
Date: Fri, 16 Jan 2004 21:19
Date: Fri, 16 Jan 2004 21:19
103 lines
4227 bytes
4227 bytes
I must say, I never expected that it was that difficult! It sort of makes me feel vindicated though! :) ========================================= Raymond Messier Software Programmer Practicewares Dental Supply voice...: (916) 638-8020 ext. 3108 fax.....: (916) 638-9307 email...: rmessier@practicewares.com ========================================= -----Original Message----- From: Richard Ronnback [mailto:member@adobeforums.com] Sent: Thursday, January 15, 2004 2:20 PM To: adobe.scripting.indesign@adobeforums.com Subject: re: [VB] Tough nut to crack, generate an index A new message was posted by Richard Ronnback in InDesign Scripting -- [VB] Tough nut to crack, generate an index Raymond, InDesign does not support grep searches so you will have to attack it in a slightly different way. You could try to use the find method and search for ~ which InDesign. The result of the search will be an array. However, I think that InDesign will not consider that tilde-sign as belonging to the following word. To get the word I think you have to loop through the array, grab the character index, (index, meaning the character's position in the text flow) increase it with +1 (so you end up in the following word) and then ask that increased character for it's parent word. Once you got it you can do what ever you want with it. If you add or remove characters you will have to loop backwars, otherwise you will destroy you references. On 04-01-15 22.36, in article 3A6F59D826A18A439BEAC32F8FAD4A2416F4AF@hq00s10024.practicewares.net, "Raymond_Messier@adobeforums.com" <Raymond_Messier@adobeforums.com> wrote: > I need to generate an index in VB Script. So far I know what I have to > do, and here is how I was figuring on doing it. I use InData to spray > the text in. Around the words I want to index I drop a glyph to mark > it. So, what I need to do is to do a search and replace for what is > between the glyphs and exchange it with an Index marker of some sort. > Has anyone done something like this? Basically what I want to do it... > > So I would have text that looked like this > > ~Important Header~ > Here is the text for the important header > > ~A somewhat more important header~ > Here is the text for the more important header > > For each word in document > get word > if word begin with "~" > select from start of "~" to end character (1st instance) remove > special_chars insert index entry from selected text > end if > Next word > > > > I cannot figure out how to do the replace or the index entry?! Can > anyone help? > > > ========================================= > Raymond Messier Software Programmer > Practicewares Dental Supply > voice...: (916) 638-8020 ext. 3108 > fax.....: (916) 638-9307 > email...: rmessier@practicewares.com > ========================================= > ------------------------------------------------------ View/reply at <http://www.adobeforums.com/cgi-bin/webx?13@@.2ccf6515/0> Replies by email are OK. Use the unsubscribe form at <http://www.adobeforums.com/cgi-bin/webx?280@@.2ccf6515!folder=.eea52bc> to cancel your email subscription.
Technical Details
Message-ID:
<3A6F59D826A18A439BEAC32F8FAD4A2416F4B5@hq00s10024.practicewares.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<3A6F59D826A18A439BEAC32F8FAD4A2416F4AF@hq00s10024.practicewares.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,9f6ae244800c3853 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-16 13:37:55 PST From: Raymond_Messier@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: [VB] Tough nut to crack, generate an index Message-ID: <3A6F59D826A18A439BEAC32F8FAD4A2416F4B5@hq00s10024.practicewares.net> Date: Fri, 16 Jan 2004 13:19:51 -0800 References: <3A6F59D826A18A439BEAC32F8FAD4A2416F4AF@hq00s10024.practicewares.net> Lines: 110 content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Thread-Topic: [VB] Tough nut to crack, generate an index Thread-Index: AcPbtb9z7dN4ZsLjSZ6PHdjXVPBLwgAwKukw MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit