Pages: 1
Print
Author Topic: Select content after PasteString()  (Read 1932 times)
gcrews
Member

Posts: 265


« on: December 13, 2013, 03:20:54 PM »

XMetaL(R) Author Enterprise 7.0
Version#: 7.0.0.111

Is there a way to select the pasted content after calling Paste() or PasteString()
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #1 on: December 13, 2013, 03:28:06 PM »

Maybe something like this:

Code:
//XMetaL Script Language JScript:
var rng1 = ActiveDocument.Range;
var rng2 = rng1.Duplicate;
var str1 = "test";
if(rng2.CanPaste(str1)) {
  rng2.PasteString(str1);
  rng1.ExtendTo(rng2);
  rng1.Select();
}
« Last Edit: December 13, 2013, 03:30:07 PM by Derek Read » Logged
gcrews
Member

Posts: 265


« Reply #2 on: December 13, 2013, 03:39:26 PM »

Perfect works exactly as I needed, Thanks for the help and quick reply. I would have never thought about creating a duplicate range selection variable or even knew to use the ExtendTo method.
Logged
Pages: 1
Print
Jump to:  

email us