Writing Macros

I’m a programmer and I’m a writer. And so, I’ve combined the two skills to create some programs that can analyze sentences and improve your writing.

You need two big parts. One: You will need to use LibreOffice for these. OpenOffice is no longer supported and not everyone has Microsoft Word. But LibreOffice is freely available. Once you have it installed, follow the (hopefully complete) three-part instructions below.

Prologue: You will need my macro files. There should be five.

PART 1: Create the Macro Templates

1. Open LibreOffice Writer

2. Go to Tools -> Macros -> Organize Macros -> Basic…

3. Click the “Organizer…” button.

4. In the Modules tab, select the Standard folder under “My Macros.

5. Click “New…”

6. We’re going to make three of these. Name the first “Dialog”. A new entry called “Dialog” should show up.

7. Click New again. Name this one “Helpers”. A new entry called “Helpers” should show up.

8. Click New again. Name this one “MainMethods”.

9. Highlight “Dialog”. Click “Edit”. A scary-looking Macro-editing screen should appear.

PART 2: Enter the Macro Text

10. Highlight all the text within the Editor pane and delete it.

11. Go to File->Import BASIC… Select the file “Dialog.bas“. The contents of the file Dialog.bas should appear in the pane.

12. Now we’re going to do the same with the two others. Double-click on “Helpers” and delete all the text within the Editor pane.

13. Go to File->Import BASIC… Select the file “Helpers.bas“.

14. Highlight MainMethods and delete all the text within the Editor pane.

15. Go to File->Import BASIC… Select the file “MainMethods.bas“.

16. Now we’ll add dialogs. Go to File->Import Dialog… Choose “MainMenu.xdl” You should see the MainMenu dialog box appear if successful.

17. Go to File->Import Dialog… Choose “WordsInSentence.xdl” You should see that dialog box appear.

18. Now save and close this Macro Editor window. That’s it for adding files.

PART 3: Adding a Button to the Toolbar

19. Go to View->Toolbars->Customize


20. Click the “Toolbars” tab. Select the category “Macros”. Select the command MyMacros->Standard->Dialog->startMainMenu

21. Click the right-facing arrow to move the command over to the toolbar. The command will be placed above wherever you currently have selected. (I like to put mine after “Formatting Marks”.) Make sure the checkbox is checked so it shows up.

You should now see the “startMainMenu” command in your LibreOffice Writer toolbar. But we don’t want that ugly old text. We want a cute icon.


22. Click “Modify -> Rename” to rename “startMainMenu” to something user-friendly. (I like “Writing Macros”.)

23. Click “Modify -> Change icon”. You can choose one of LibreOffice’s icons or import a 24×24 image of your choosing.

24. Click OK and that’s it! You’re done!

In LibreOffice, click the icon you just added and the main menu should display.

Choose one of the options and away you go.

What do all these commands do?

Some are pretty self-explanatory, but others aren’t.

Clean Up Document

This fixes some common formatting and style errors that are either hard to see or can be the fault of LibreOffice thinking it knows what you want to do.

  • Puts one space after each sentence. This is standard formatting for computer-typed documents, which no longer need such large distinguishing between sentences.
  • Replaces manual line breaks. If you ever use “view formatting”, there should be a little ¶ after each paragraph. However, sometimes there are little left-pointing arrows (↵) instead. These can mess up text if you switch font sizes.
  • Replaces “smart quotes” with “straight quotes.” Smart quotes and smart apostrophes never align right and don’t copy and paste into other formats. Most word processors allow you to turn them off, but some forget to include auto-correct in this. Meaning if you type “doesnt”, it will auto-correct to “doesn’t” (with the smart apostrophe) instead of “doesn’t”.

Find Long Sentences

I usually set it to a max of 20 for short stories and 23-25 for novels. Mostly, you’re looking for run-ons and comma splices, but also, break up those sentences that are just too damn long. Sentences that are lists or have distinctive divisions around clauses (like the emdash that J.K. Rowling is so fond of) are okay, IMO.

Find “Telling” Cues in Narrative/Dialogue

Looks for poor verbs that indicate either the narrator or speaker is telling, rather than showing the reader. Commonly finds instances of “he/she looked”, “he/she saw”, “he/she thought”, etc.

Find Dangerous Phrases

There are some common “gotchas” that smear the effectiveness of a sentence through passive voice or unnecessary words. The sentence needs to be rewritten stronger, use better words, or maybe eliminated altogether.

  • Instances of “he/she felt” or “he/she saw”: These words mean you’re filtering the sentence through someone else’s POV, which dilutes the impact. Not looking for “he felt a concrete wall”, but “he felt bad”. That’s the time you should show, not tell.  Any characters you write in the input box will be accounted for too (so you can highlight instances of “John felt” or “John saw”).
  • Instances of “there was” or “there were”: This is a variation of “to be”, which is not terribly exciting. You should be using a better verb. (Note: Don’t bother searching for the instances of “to be”. You’ll claw your eyes out after ten pages).
  • Instances of “was being” or “were being”: A clear indicator of passive voice.
  • Instances of “and then”, “, and” & “, then”: Two separate sentences joined for no reason. Try splitting them.

Find Poor Uses of “It”

  • Sentences that start with “It”: Look for when “it” either doesn’t refer to a real subject or signifies that you’re spoon-feeding info to the reader. If you say “it was raining”, what is “it”? The sky? The Earth? The weather? Change these so there’s an actual subject. “Rain fell.”
  • Instances of “it was” (and “it wasn’t”): Usually a sign of restating something obvious.

Find Past Perfect

Past perfect is “had” and “had been”.  Clearly, we’re not looking for “the machine had a button”. We’re looking for actions that were completed before something in the past. Look for passive voice.

Asked vs. Said

I have a bad habit of making dialogue tags like “What is that?” John said. Especially for rhetorical questions. These should be “asked”.

Find Present Participle

Present participle is “was xxxing”. It’s a continuous action, and often, you should be using the verb itself. For example, instead of “he was watching”, use “he watched”. This is more immediate and less wordy. Gerunds are not our friends.

Find Cliche Words

Looks for overused phrases and meaningless phrases often found in bad writing, like “spin around”, “piercing”, “needless to say”, “down in the dumps”, “utilize”, “in order to”, and so on.

Find “You” in Narrative

Example: “You would think that the earth is flat, but it is, in fact, round.” That’s not good. That’s a quick shift into the second-person perspective. A construction like “One would think…” could be used, but that’s a bit lazy too. Try for a better subject like “Most people thought…” or “Common knowledge stated…”

Find “That” in Narrative/Dialogue

Finds instances of the word “that”, which is also a crutch word.

Find Single Quotes in Narrative

The only time single quotes should be used is for dialogue inside of dialogue. All other times, use double quotes.

Find Questionable Adverbs

Probably one of the most useful macros. They say you should search and destroy words that end in “-ly”. Well, why not let someone else do it? (OK, it won’t destroy them, but it’ll highlight them.)

The code contains an adverb exclusion list. These are the words that are ignored in the adverb search–words like “fly” (verb) or “family “(noun) or “steely” (adjective). If you find some “-ly” words that are not adverbs, let me know and I’ll add them to this list.

Highlight Digits

All digits should be written out.

Find Common Apostrophe Errors

Highlights all instances of it’sitsher’s, and who’s/whose. Even knowing when to use each, I still write the wrong one sometimes. This will point out each so you can quick-review them. What I do is read the phrase and, in my head, substitute “it is”. If the sentence sounds right, the word should be it’s. If not, the word should be its.

Her’s is not a real word. It’s hers. There’s no his’s or hi’s, so there’s no her’s.

Who’s is a contraction of who is (the equivalent of it’s). Whose is the possessive of who (the equivalent of its).

Find Overused Words in Narrative/Dialogue

Similar to Find Dangerous Phrases and Find Cliche Words. Looks for “bad writing tip-offs” like “um”, “er”, “uh” (unnecessary and wordy), “attractive”, “colorful” (telling instead of showing), “begin to”, “start to” (only necessary when the action is being interrupted), “found his”, “just”, “kind of”, “many”, “seems to”, “somehow”, “sighed”, “glanced”, and so on.

Find Unsophisticated Sentences

Finds sentences that indicate simultaneous actions (e.g. “He blanked as he blanked”, “As he blanked, he blanked” or “Blanking something, he blanked”). These should be changed to “He/She blanked _____ and _____.” and/or “He/she blanked, ________.”

Note this macro is a work in progress. As Willy Wonka said, I don’t have it quite right yet. It won’t work for the present or future tense and it isn’t very accurate. It’s similar to “Find Present Participle”, so you could use that instead.

Find “Knowing” Words in Narrative

Finds and highlights words regarding “knowing” or “wanting” something, which is “telling” not “showing”. Only applies to narrative.

Find Lay vs. Lie

The hobgoblin of all grammar nazis. It highlights instances of these words and provides a reminder of how to use each (which I will display for you now).

“Lay” means to place something on something. It is an action verb performed on something/someone. It must have a direct object.

“Lie” means to recline. It can never have a direct object following it.

LAY
  • I lay the book down. (present – 1st person)
  • He lays the book down. (present – 3rd person)
  • I laid the book down. (past)
  • The book was laid down.
  • The book is laying down.
  • I will lay the book down
LIE
  • I lie down. (present – 1st person)
  • He lies down. (present – 3rd person)
  • I lay down. (past)
  • I will lie down.
  • I am lying down.
  • I have lain down.

Special: Highlighting and Formatting

There are some macros grouped in the lower right corner. These are for formatting and not supposed to be run with the other macros. They’re useful for other stuff.

For example, highlighting only dialogue will make it easier to read only the quotations. They say that in a well-written book, you can read only the dialogue and still mostly understand a story. Reading only the narrative helps you know if you’ve got the mood and tone you’re going for.

Converting styles helps when reformatting into plain text or manuscript format. The plain text one changes all instances of bold to *asterisks*, italics & underline to _underscores_, and converts paragraphs into line breaks (HTML style, with spaces between paragraphs and no indenting).

Manuscript formatting does the same for bold, but converts italics to underline (and leaves paragraphs alone).

Tricks & Tips

None of these macros are particularly optimized. I’m not a VB expert. So for large documents, it might run slow (even as long as twenty minutes). But it should complete. If it doesn’t, you should get an error. Otherwise, when the macro is finished, it will pop up a message saying “blah-dee-blah macro is done” to let you know it completed successfully.

Start with short documents first to get a feel for how the macros run. Some take longer than others.

One Last Thought

This is not meant to be an end-all-be-all hunter-killer. Just because it gets highlighted doesn’t mean you HAVE to change it. Examine the suspect words and see if they’re appropriate, used effectively, and don’t need something stronger. Simple can be good. It’s not about using the best word, it’s about using the right word.

If you have any questions or need clarification, please send me an e-mail or leave a comment. I’ll try to help you AND keep this post updated. But I can’t help if I don’t know the problem. So please don’t think twice about dropping a line.

Troubleshooting

Problem: I got a “Subrem” error when I tried to run something.

Solution: You probably didn’t remove the text in macros in step X. Follow the steps from Step X onward to get back to that screen. Delete everything in the pane. Then import the appropriately named .bas file.

Problem: I did some macros in LibreOffice then opened my document in Word. Now I’m having trouble with the highlighted text (a.k.a. character back color).

Solution: For some reason, this doesn’t play well with Word’s highlighting function. So if you open a document in OpenOffice, highlight stuff, then open it in Word, it’s hard to get rid of/clear the highlighting.

Problem: One of your stupid Macros locked up my machine.

Solution: Press CTRL+Break to get out of the macro. There’s