Kathe Todd Re: [KEYWORD] - Re: GREP search to end of story
Mar 29, 2010; 13:24
Kathe Todd
Re: [KEYWORD] - Re: GREP search to end of story
Hmm, having a hard time figuring out how to translate this into VB. What exactly would the syntax of the "txt.findText" command look like? What I'm trying to do is move from the insertion point next to the book title in catalog text to the first instance of a product code following it, then copy that to the clipboard so I can use that as a key to find the picture to place next to the title.
Dim mySelect = myDoc.Selection Dim found = myDoc.FindGrep() If found.Count > 0 Then found(1).Select() Idapp.Copy() myDoc.Selection = mySelect End If
This delivers a product code to the clipboard and then puts the cursor back where it was when I started; but unfortunately it's delivering the first product code to be found in the text, three pages back. Visual Studio says there's no such thing as a ParentStory property in the ID object model for type "Object" - which is what mySelect is...
-----Original Message----- From: InDesign Talk [mailto:indesign@lists.lassosoft.com] On Behalf Of Robert Tkaczyk Sent: Monday, March 29, 2010 11:49 AM To: InDesign Talk Subject: [KEYWORD] - Re: GREP search to end of story
> If you can translate this JavaScript code into VB: > > if (app.selection[0] instanceof InsertionPoint) > { > var story = app.selection[0].parentStory; > var txt = story.insertionPoints.itemByRange (app.selection[0], > story.insertionPoints[-1]); > } > > then you'll have a text object (txt) in which you can search, e.g. > using > txt.findText()
set myInDi = CreateObject("InDesign.Application") set myDoc = myInDi.ActiveDocument
If myInDi.Selection.Count then if myInDi.selection.Item(1).TypeName = "InsertionPoint" then set mySelStartPoint = myInDi.selection.Item(1) set myStory = myInDi.Selection.Item(1).ParentStory set myText = myStory.Texts.ItemByRange(mySelStartPoint, myStory.InsertionPoints.Item(-1)).Item(1) end if end if
unchecked but should work ;)
robin www.adobescripts.co.uk
-- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/InDesign/Browse/ Manage your subscription: http://www.ListSearch.com/InDesign/
-- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/InDesign/Browse/ Manage your subscription: http://www.ListSearch.com/InDesign/
Mar 31
Kathe Todd Re: [KEYWORD] - Re: GREP search to end of story
Mar 31, 2010; 14:06
Kathe Todd
Re: [KEYWORD] - Re: GREP search to end of story
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!