I would like to be able to open a FM 10 document at a particular paragraph, so the paragraph is scrolled to. I want to pass the paragraph ID for a heading and have the heading at the top (or at least within the visible portion) of the document window. Is this possible?
Yes, this is possible. How do you want to invoke the script and where will you get the paragraph id?
I am creating an oXygen plugin that can open the FM source file for a DITA file converted from FM. The conversion utility uses the paragraph ID of the heading in the file naming scheme. The plugin is written in Java. I'm not sure what the best way to invoke the script would be.
A script can be invoked automatically on FrameMaker startup. As far as I know, the script has to be in one of the startup folders:
C:\Program Files (x86)\Adobe\Adobe FrameMaker 2015\startup
If the correct script was in one of these locations, you could have your program launch FrameMaker from a command line and then the script would navigate to the document in the document. You would probably want your process to move the script out of the startup folder after it runs, unless you want it to run every time FrameMaker starts.
I may not be totally understanding what you want to do. If you want to discuss if via phone or email, please contact me at rick at frameexpert dot com. I will be glad to take a look at what you are doing.
In addition to what Rick said, this is certainly possible and reasonably simple. You would need to set up a text range using the paragraph ID, then use the ScrollToText function or method. So, that answers the question of whether it is possible. How much help are you looking for?
Thank you both for your help so far. Currently, my Oxygen plugin can determine which .fm file was the source of the converted .dita file and a user can click a button to open that .fm file in Framemaker. The .dita filename contains the paragraph ID for the heading, so I can get that information as well.
I would like the plugin to be able to either:
Open Framemaker if it is not open and open the file, scrolled to the heading text.
If Framemaker is already open, but the file is not, open the file to the heading text.
If Framemaker is already open, and so is the file, scroll to the heading text.
Unfortunately my FM scripting skills are mostly non-existent right now, but hopefully with some pointers I can figure it out. I do have some programming experience, but not specific to this, so any help is greatly appreciated. Thanks again!
The basic task of opening a doc and scrolling to a place is reasonably straight-forward. The tricky thing is the contingency of whether FM is already open or not. With reasonable simplicity, you can start FM and have it run a plugin or script automatically. More complicated is a call to FM from an external program (ie, your Oxygen plugin) to do something. To be honest, I am not clear on how this could be done, but I know it can because I've seen it done. With this, though, I think you are definitely getting into the area of FDK development and away from scripting, which adds complexity.
Can anyone else out there suggest a good way for an external program to execute a command within FrameMaker? I would like to know myself.
In all cases, I think you may not get everything you need in this forum. You are touching on a variety of areas that require substantial expertise. You may need to prepare yourself for some study time or be willing to pay for a little help. We are totally willing to help with specific questions, etc., but the scope of this project may exceed a reasonable standard of generosity.
Thanks again. Would it be easier if FM was definitely open?
Can anyone recommend good resources to learn more? I'm not expecting everything to be handed to me; I'd rather learn. But I'm having a hard time finding information.
If FrameMaker is already open, you would need to execute a command within the session. I know this is possible but I don't know how to do it. That's why I posed the question in my previous post. I believe that in any case, you would need to use the FDK and its C libraries, because it seems unlikely that ExtendScript would provide this ability.
Conversely, if FM is not open, it is reasonably simple to execute an FDK plugin or an ExtendScript upon startup. This plugin or script could do what you wanted without major complication.
Resources for learning the FDK are very limited. For ExtendScript, there are a few samples out there, including a general collection on my website:
Hope this helps some.