FMPython: Download Here
FMPython integrates a Python interpreter in Framemaker, so that you can write Python scripts to automate Framemaker operations. Versions exist for Windows and Mac. This provides a good free alternative to Framescript or the Frame Developer Kit for Frame programming.
Stefan Petrucha’s tool has, however, been unavailable for download for some time, as noted in an earlier post on this blog.
Now, however, one user who downloaded FMPython has provided us with a copy of the Windows version. Until Stefan tells us to stop, we will host a copy here that you can download.
If you use FMPython, and wish to report your experiences, please post comments on this blog and we will share those experiences with the rest of the community.
Thanks…
Download FMPython 0.2.1b for Windows here
– The Source

























rabarberski wrote:
Has anybody successfully installed this tool with FrameMaker 7.2 and Python 2.5 (or any other versions for that matter)?
I copied the .dll into FrameMaker’s plugin folder, but when I start FrameMaker, I am greeted with:
“Cannot initialize API client c:\program files\adobe\framemaker7.2\fminit\plugins\python\fmPython22.dll.
Check for errors in the APIClients section of C:\Program Files\Adobe\FrameMaker7.2\maker.ini,verify that the client program exists, and make sure you have enough swap space to run the client.”
The fmPython documentation says (on page 13) “The [python] interpreter must be
compiled as a shared library to be usable by fmPython and the version number must match.”
If I do a standard installation of Python, is the “compiled-as-shared-library” requirement fulfilled?
Posted on 13-Apr-07 at 8:55 am | Permalink
rabarberski wrote:
Update: I got fmpython working by installing the older version Python 2.2.3 (instead of Python 2.5) AND restarting my computer.
(First, I fiddled around with renaming the “python25.dll” in the python installation folder to “python22.dll” and moving it various folders, but I couldn’t get that working.
The restart of the computer seems necessary to make FrameMaker find the shared library “python22.dll”.)
Posted on 16-Apr-07 at 1:56 am | Permalink
admin wrote:
Glad to hear you got it working. Thanks for the details.
Tell us what you use fmpython for…
Posted on 16-Apr-07 at 3:08 am | Permalink
rabarberski wrote:
>> Tell us what you use fmpython for…
Nothing yet.
I still have to learn Python as well, which I intend to do by using it for automating some tasks in FrameMaker. Can’t think of anything at the moment, but I am sure useful things to automate will turn up (such as searching for paragraphs *in tables* with specific styles that need to be replaced by an other style…).
It is a bit of a shame that the accompanying fmpython PDF manual does not give any short script examples…(e.g., inserting a word at the very beginning of document)
Is there anybody who could do so?
Posted on 16-Apr-07 at 4:47 am | Permalink
admin wrote:
rabarberski, we’ve considered starting a Wiki as part of this site, where people could compile tips and tricks and useful scripts. I think that would be an ideal place to collect such useful examples. It’s a matter of finding time to do this, of course…
Actual experimentation from us, i.e. the generation of useful samples of fmpython, isn’t likely to come any time soon, alas.
Seriously, though– anything you do manage to accomplish, if it’s not proprietary, please share.
Posted on 17-Apr-07 at 4:34 pm | Permalink
rabarberski wrote:
Again, I’ve made some small progress.
Using Google I’ve found some (about 2) examples (do a newsgroup search on fmpython).
Using these, I managed to create the following pointless script (it is actually more a compilation of tiny code snippets), which nonetheless might help other people to get started…
Once I have something more useful (might take a while), I’ll post it here.
Instructions:
1. copy the code below in a new FrameMaker document
2. for readability, set the font to Courier New, 10pt
3. select all code and click (in the menu bar) fmPython > Selection as script
4. Open (or create) another FrameMaker document to run the script on
5. Click fmPython > Execute script
Output should now appear in the FrameMaker Console (pops up automatically) and the document should be printed.
Depending on the document you try it on and the amount of paragraphs it contains, the script might take some time. Just be patient.
# Start copying here #
#These three lines are required for all subsequent blocks
import maker
ses = maker.session
doc = ses.activeDoc
#print document name (does not work for an unsaved document)
print doc.path
# Show FrameMaker version
os = ses.windowSystem
product = ses.product
version = str(ses.majorVersion) + “.” + str(ses.minorVersion)
print “You are using ” + product + ” ” + version + ” on ” + os
# Toggle Automatic change bars setting
if doc.autoChangeBars==0:
print “Automatic change bars were turned OFF”
doc.autoChangeBars=1
print “Automatic change bars are now turned ON”
else:
print “Automatic change bars were turned ON”
doc.autoChangeBars=1
print “Automatic change bars are now turned OFF”
#Delete selected text in document
#(disabled, so that this is not accidentally executed)
#rng = doc.textSelection
#rng.delete()
#Delete first occurence of a variable in the document
#(disabled, so that this is not accidentally executed)
#rng = doc.firstVar.textRange
#rng.delete()
#Loop through each paragraph in the document and RIGHT align it
#ATTENTION: there are more paragraphs in the document than
# just the ones on the body page. The master page and
# reference page also contain (a lot) of paragraphs!!
# This also explains why doc.firstPgf doesn’t point to
# the first paragraph on the Body page.
par=doc.firstPgf
c_par=0 #this is just a counter for outputting purposes
print “Starting paragraph loop …”
do = 1
while do:
try:
c_par = c_par+1
if (c_par % 10) == 0: #show progress in Console every 10 paragraphs
print str(c_par)
par.alignment=maker.symbol.ParaAlignRight
except RuntimeError:
pass
try:
par = par.nextInDoc
except RuntimeError:
do = 0
print “…Finished paragraph loop”
#send document to printer (i.e., print
doc.Print()
Posted on 18-Apr-07 at 7:58 am | Permalink
rabarberski wrote:
Ouch, the indentation seems to have been removed when posting.
Below is a repost of the sections that require some indentation, with the required leading spaces replaced by @-signs. (couldn’t think of anything better)
if doc.autoChangeBars==0:
@print “Automatic change bars were turned OFF”
@doc.autoChangeBars=1
@print “Automatic change bars are now turned ON”
else:
@print “Automatic change bars were turned ON”
@doc.autoChangeBars=1
@print “Automatic change bars are now turned OFF”
while do:
@try:
@@c_par = c_par+1
@@if (c_par % 10) == 0: #show progress in Console every 10 paragraphs
@@@print str(c_par)
@@par.alignment=maker.symbol.ParaAlignRight
@except RuntimeError:
@@pass
@try:
@@par = par.nextInDoc
@except RuntimeError:
@@do = 0
print “…Finished paragraph loop”
Posted on 18-Apr-07 at 8:04 am | Permalink
Shaun Kelly wrote:
I used fmPython to create a script to mass delete unwanted styles from a FrameMaker document. My script is documented here:
http://blog.shoap.com/2007/10/10/how-to-mass-delete-unwanted-styles-in-framemaker-using-python/
Posted on 11-Oct-07 at 3:44 pm | Permalink