I have a script that searches for text with an outline color, removes the outlnie color, cuts it from the main "body" text, adds an anchored frame, applied an object style to that frame and pastes the cut text in the frame.
Everything works great except that it is REALLLLLLYYYY SSSSSLLLLLOOOOOWWWWW.....
I'm wondering two things. 1, is there a way to cut text without havnig to select it first (which seems to be a slow point) and keep any current formatting, and 2, is there a way to get InDesign to stop jumping to the page on which the cutting is occurring? It looks like InD scrolls the pages when the cut occurs.
My code looks roughly like this (VBA, InD CS3).
I define the text area so search
Set SChar = InD.Selection(1).ParentStory.Characters(InD.Selection(1).InsertionPoints(-1).Index) Set up my search stuff here... Then execute the search as such:
Set EChar = InD.Selection(1).ParentStory.Characters(-1)
Set SrchTxt = InD.Selection(1).ParentStory.Texts.ItemByRange(SChar, EChar)
Set SChar = InD.Selection(1).ParentStory.Characters(InD.Selection(1).InsertionPoints(-1).Index)
Set up my search stuff here...
Then execute the search as such:
Set Foundd = SrchTxt(1).FindText
I thought about using something like Foundd(i).cut or trying to simply set the text of the new frame to the text of the old frame but didn't see a way to do that and keep any potential formatting.
No selection needed for that.
WOW! Between not having to select the item and InD no longer scrolling through the pages I'm getting at least double the speed! Never thought of the move function in relation to text.
Now maybe the only other thing that might get a little more speed is adding the frame at the initial size I need rather than adding it then resizing it. Any thoughts on that would also be greatly appreciated.