Archive for January, 2008

Controlling Word the Lispy Way

Tuesday, January 29th, 2008

In my last post I asked whether anyone knew how to replace automatically numbered paragraphs in MS Word with their textual (non-auto) equivalents.

No one replied.

So I had to do it myself. Startlingly simple for my humble needs, the solution consists of a key-code invoking a macro which shells out to cscript running a Jscript program. The slightly interesting point is that this last is generated by Parenscript, and looks like so:

(defvar wd-app (*get-object "" "Word.Application"))
(defvar a-doc wd-app.*active-document)

(defun de-number ()
  (let ((cnt a-doc.*lists.*count))
    (dotimes (i cnt)
      (let ((lst (slot-value (a-doc.*lists 1)
        (lst.*convert-numbers-to-text 3)))))

This is obviously far from being great style, but it gets the job done and has me wondering about all the other things I could be doing with parentheses…

In praise of VBacs

Wednesday, January 9th, 2008

For my sins I spend most of the (work) day in Microsoft Word. In order to make this experience bearable I turn off as many of the automatic mangling features as I can and install VBacs, which provides a basic set of Emacs keybindings for Word. This means I can C-x C-f, C-x C-s, C-s, C-r, M-%, M-w, C-y etc. to my heart’s content. VBacs doesn’t turn Word into Emacs, but it does help me concentrate on changing the text rather than where simple keybindings might be.

VBacs – give it a go if you’re sentenced to Word.

PS. Does anyone have a programmatic way to replace the furshlugginer automatic numbering in a Word document with its textual equivalents? (That is, replace the automatically inserted numbering “1.13” with the text “1.13”.)