Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Move the insertion point?

Guest
Mar 13, 2008 Mar 13, 2008
Just when I think I'm starting to get this . . .

How the blankety-blank-blank to I simply move the insertion point to the next line whether it be within the same paragraph or not, like hitting a down arrow key?!?!

Thanks
TOPICS
Scripting
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 13, 2008 Mar 13, 2008
That's a strange thing to want to do in a script. You're going to have to use the horizontal offset of the current insertion point to work out where in the next line to move the insertion point.

For example, you might use these techniques:

myIP = app.selection[0];
if (myIP.hasOwnProperty("baseline") {
// we have a text selection
myNextLine = myIP.lines[0].insertionPoints[-1].lines[0];
myHO = myIP.horizontalOffset;
nextHOs = myNextLine.insertionPoints.everyItem().horizontalOffset;
for (var j = 0; nextHOs.length > j; j++) {
if (nextHOs > myHO) {break}
}
app.select(myNextLine.insertionPoints);
}

I'm 3,000 miles away from my InDesign installations at the moment so I can't test that, but it'll sort of work. It the next line is on the next page, you'll be in trouble, and if there's a text wrap or something, you might end up at the start of the line after next. But this should give you the idea, assuming, that is, that you want to use JavaScript.

Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2008 Mar 14, 2008
I think Ken misunderstands the 'insertion point' name. It is not the position of the cursor, but more of an array of 'current' positions per character index. Each and every displayed character has an insertion point value; you can access this for each and every text refererring object (Story, Paragraph, Words, Lines, Characters, ... I'm sure I forgot a few).
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 14, 2008 Mar 14, 2008
LATEST
Thanks a bunch guys. Dave that code makes perfect sense, even though I'm not in Java for this project and jongware you're exactally right, I was thinking backwards in terms of insertion point.

Sigh . . . ever onward.

Ken
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines