[JS ID CS5] I fail to use move instead of copy
Hello everyone,
A little while ago I started working on my first InDesign script. It is a script that places a Word file in an InDesign-file and then searches for tags. Text between these tags needs to be moved to certain text frames already in the InDesign file. So far things are working great. However, I read on this forum that it is better and faster to use the move function instead of using select, cut and paste to move text to a different text frame. I can't get this to work.
This is the working script i use to copy/paste some text to the appropiate frames.
app.findGrepPreferences.findWhat = "<paragraaf1>.+</paragraaf1>";
var gevondenTag1 = myDocument.findGrep();
app.cut(app.selection = gevondenTag1);
app.select(bestaandTextFrame1.parentStory.insertionPoints.item(0));
app.paste();
As I said, this works ok. But since i want to run this script on about 600 Word files, speed is an important factor. So i tried to use move.
The script I wrote and doesn't work is this:
app.findGrepPreferences.findWhat = "<paragraaf1>.+</paragraaf1>";
var gevondenTag1 = myDocument.findGrep();
bestaandTextFrame1.parentStory.insertionPoints.item(0).move(LocationOptions.before, gevondenTag1)
Does anyone have an idea what i'm doing wrong? How can I get this to work?
Thanks in advance!
Michiel Koers,
Mediadesigner at M-effect