Skip to main content
Jul 16, 2014 2:27 PM UTC
Question

synchronized scrollbars of differents documents (using FM10)

Someone know how can I move two or more scrollbars of documents in the same FrameMaker process? I tried to search in the web but I found anything.. If someone know the code that I can use, please post it here.

Thank you           -Marco

This topic is closed to new replies. Start a new post to keep the conversation going.

12 replies

Participating Frequently
Jul 19, 2023 4:52 AM UTC

This problem can be solved with a script.

Try the following steps.
1. Run this script.
2. Open all documents.
3. Place the cursor inside the paragraph.
4. Operate the mouse wheel on the small scroll bar.

 

var w = new Window("palette");
var sbar = w.add ("scrollbar", [0,0,20,100], 50);
sbar.onChange = function () {
    var doc = app.FirstOpenDoc;
    while (doc.ObjectValid()){
        if (doc.TextSelection.beg.obj.ObjectValid()) {
            app.ActiveDoc = doc;
            if (sbar.value<50){
                //Cursor (insert point) moving commands
                //Previous paragraph start
                Fcodes([FCodes.CSR_BOP]);
            } else {

                //Next paragraph start
                Fcodes([FCodes.CSR_NEXT_BOP]);
            }
        }
        doc = doc.NextOpenDocInSession;
    }
    sbar.value = 50;
}
w.show();

Translate
Jul 30, 2014 8:22 AM UTC

I found a solution, who are intresting about it must contact me privately. My email is: marco.dona1996@gmail.com


-Marco

Translate
K.Daube
Community Expert
Community Expert
Jul 23, 2014 2:55 PM UTC

You can solve the problem with an external script (AutoHotkey script), which sends keystrokes to FM (ah, I'm missing "insert code" in this editor):

ScrollBothDn:
  WinActivate,  ahk_class FrameFamily9.MdiFrame
  WinActivate,  ahk_class FrameFamily10.MdiFrame
  WinActivate,  ahk_class FrameFamily11.MdiFrame
  WinActivate,  ahk_class FrameFamily12.MdiFrame
  Send, {PgDn}                          ; scroll this down
  Send, ^{Tab}                          ; switch to other doc window
  Send, {PgDn}                          ; scroll this down
  Send, ^{Tab}                          ; switch to first doc window
Return

ScrollBothUp:
  WinActivate,  ahk_class FrameFamily9.MdiFrame
  WinActivate,  ahk_class FrameFamily10.MdiFrame
  WinActivate,  ahk_class FrameFamily11.MdiFrame
  WinActivate,  ahk_class FrameFamily12.MdiFrame
  Send, {PgUp}                          ; scroll this down
  Send, ^{Tab}                          ; switch to other doc window
  Send, {PgUp}                          ; scroll this down
  Send, ^{Tab}                          ; switch to first doc window
Return

I have implemented this in a small Utility TextHelper .

If You want to scroll by page rather by screen (you need to have the same zoom level though) - you can set up a small customui.cfg for the fminit folder:

<Modify GotoPreviousScreen<KeySequence /F11>>
<Modify GotoNextScreen  <KeySequence /F12>>
<Modify GotoPreviousPage <KeySequence /PgUp>>
<Modify GotoNextPage  <KeySequence /PgDn>>

Klaus Daube

Translate
Legend
Jul 16, 2014 3:13 PM UTC

Marco,

Are you using ExtendScript? If so, the only way I know to move a scrollbar (without programming to the Windows API) is to use the ScrollToText() method. This will scroll a document to a specific spot, more or less. But, you would have to know where you want to scroll to and you would have to be able to respond to a scroll action in another window. I don't know that this is possible.

The more I think about it, this may not be possible using FrameMaker development tools alone. I don't think there is any way to automatically respond to a scrolling action, which would be required to trigger a scroll in another window. Plus, it would be real tricky to figure out how far to scroll, etc.

What is the specific reason you want to do this? Perhaps there is an alternative.

Russ

Translate
Jul 16, 2014 3:36 PM UTC

Hi Russ,

The reason because I need to control the scrollbars is that I need to compare many documents (I work with many manuals in more than eight languages), so I need to view if the images are in the same position etc. I would have a system to scroll together the scrollbar of my documents such as the "synchronized scrolling" in MS Word. I wrote about script but I'm not sure that is the best way to resolve my problem, in this world I'm a novice. If you know something better than my ideas please tell me.

Thank you,            Marco

Translate
Legend
Jul 17, 2014 12:06 PM UTC

Hi Marco,

Usually, I like to say that anything is possible with scripting, but in this case I see no easy way. I don't really know where I would even start, were it my task to accomplish. My thought is that FrameMaker is simply not designed to readily support this. If I am wrong, I hope someone can step in and correct me. I apologize that I could not provide a more productive answer for you.

Russ

Translate