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

Framemaker doesn't show where text or objects are selected via Extendscript

New Here ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

I have some Extendscript that opens a document, locates a graphic, and selects it. The image is selected, as evident by the image details showing in Object Properties. Problem is, Framemaker doesn't scroll the window to show the selection.

So far, the only way I've been able to get Framemaker to jump to the right location is by selecting the text around the graphic, then using my keyboard I press the arrow keys to jump to the location. Then I manually select the graphic. This worked for our needs at first, but now for other scripts I really need to be able to have the image selected and visible on screen.

I even tried selecting the text around it, using fcodes to simulate the keyboard arrow keys, and then selecting the graphic, but Framemaker still didn't update what part of the document it was showing on screen.

This is my current function. Any thoughts?

//imageID is the unique ID of the frame the image is in, docName is the path & file name for the document containing the image

function findSelectedGraphic (imageID, docName) {

   

        var begOffset = 0;

        var endOffset = 0;

        var textRange;

       

        var newdoc = OpenFile(docName);

        var selectedGraph = newdoc.GetUniqueObject(Constants.FO_AFrame, imageID);

       

        if (selectedGraph.ObjectValid()) {

            var vFramePgf;

            vFramePgf = selectedGraph.TextLoc.obj;

           

            var newTextLoc = new TextLoc (vFramePgf, selectedGraph.TextLoc.offset + 1);

            textRange = new TextRange(newTextLoc, newTextLoc); 

            newdoc.TextSelection = textRange;

            var fcodes = new Array();

            fcodes[0] = FCodes.KBD_MOVE_LEFT;

            Fcodes(fcodes);

            selectedGraph.FirstGraphicInFrame.GraphicIsSelected = 1

        }

}

TOPICS
Scripting

Views

799

Translate

Translate

Report

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

correct answers 1 Correct answer

Enthusiast , Nov 17, 2015 Nov 17, 2015

Hi ricat03,

just try  "ScrollToText"

myDoc.ScrollToText (textRange);

That should work.

Votes

Translate

Translate
Enthusiast ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

Hi ricat03,

just try  "ScrollToText"

myDoc.ScrollToText (textRange);

That should work.

Votes

Translate

Translate

Report

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
New Here ,
Nov 17, 2015 Nov 17, 2015

Copy link to clipboard

Copied

LATEST

Thanks so much! That worked perfectly.

Votes

Translate

Translate

Report

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