UPDATE: This post has been amended. You can find the complete list of writer's macros here.
As part of my everlong quest to help my fellow writers, I will be posting some of the Macros I've provided (I'm a programmer!) to help out with writing.
Here is the first one, and probably the most useful. It searches for all words in a given list (adverbs, overused words, and cliches) and highlights them.
To use:
1. Copy the code below.
2. Open Word.
3. Press Alt+F8 (or go to Tools->Macro->Macros)
4. Click Edit. Microsoft Visual Basic will open.
5. In the project window (upper right), select Normal->Modules->NewMacros
6. Paste the code below into the text pane.
7. Click save and close the Microsoft Visual Basic.
If you want to change the words in any of the lists, feel free to add them. (NOTE: the adverbExList is an exclusion list. The others are inclusions)
'Finds and highlights adverbs, passive phrases, overused words, and cliches
Sub Find_Questionable_Words()
' Highlight specific types of words in current document
On Error GoTo Err_HighlightWords
Application.Run MacroName:="Clear_All_Highlighting"
Dim adverbExList
Dim passiveList
Dim overusedList
Dim clicheList
Dim adverbColor As WdColorIndex
Dim passiveColor As WdColorIndex
Dim overusedColor As WdColorIndex
Dim clicheColor As WdColorIndex
adverbExList = Array("only", "oily", "family", "homily", "Billy", "Sally", "multiply", "imply", "gangly", "apply", "bully", "belly", "silly", "jelly", "holy", "lovely", "holly", "fly", "July", "rely", "reply", "Lilly", "sully", "gully", "prickly", "crawly", "curly", "sly", "ugly", "motherly")
adverbColor = wdYellow
overusedList = Array("about", "all of a sudden", "almost", "appears", "attractive", "begin to", "beginning to", "began to", "close to", "colorful", "crossing", "creeping", "crept", "embarrassing", "even", "eyebrow", "fabulous", "fascinating", "found herself", "found himself", "found his", "found her", "get", "got", "groan", "handsome", "heaved", "hilarious", "just", "just then", "kinda", "kind of", "many", "momentous", "most", "more and more", "nondescript", "occur", "occurs", "powerful", "quite", "rather", "seemed to", "seems to", "seeming to", "show", "shows", "since", "some", "something in", "somewhat", "somehow", "sort of", "stupid", "very", "went")
overusedColor = wdTurquoise
clicheList = Array("the reason for", "past history", "this is why", "end result", "it is possible that", "the possibility exists", "for all intents and purposes", "there is a chance that", "is able to", "has the opportunity to", "past memories", "future plans", "sudden crisis", "terrible tragedy", "as a matter of fact", "quite frankly", "all the time", "white as a sheet", "as soon as possible", "at the very least", "down in the dumps", "in the nick of time", "hat in hand", "keep your mouth shut", "made a run for it", "utilize", "in order to", "the fact that")
clicheColor = wdBrightGreen
'variables
Dim word
Dim rng As Range
Dim excluded As Boolean
Dim story As WdStoryType
Dim oldTrack
Dim oldHighlight
Dim excludeQuotations As Boolean
' Save current settings
oldTrack = ActiveDocument.TrackRevisions
oldHighlight = Options.DefaultHighlightColorIndex
ActiveDocument.TrackRevisions = False
excludeQuotations = MsgBox(Prompt:="Do you want to skip quotations?", Buttons:=vbYesNo + vbDefaultButton2, Title:="Exclude Quotations?")
Options.CheckGrammarAsYouType = True
Application.Run MacroName:="Replace_Straight_Quotes_With_Smart_Quotes"
ActiveDocument.Characters(1).InsertBefore Chr(134)
' Iterate through each document section
For Each rng In ActiveDocument.StoryRanges
' Work only with the main body, footnotes and endnotes
story = rng.StoryType
If story <> wdMainTextStory And story <> wdFootnotesStory And story <> wdEndnotesStory Then
GoTo NextRange
End If
' Do the adverb highlighting
rng.Find.ClearFormatting
rng.Find.Replacement.ClearFormatting
With rng.Find
.Text = "<[! ^13]@(ly)>"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While rng.Find.Execute(Replace:=wdNone) = True
If rng.Text = "" Then
Exit Do
End If
excluded = False
For Each word In adverbExList
If LCase(rng.Text) = LCase(word) Then
excluded = True
Exit For
End If
Next
If Not excluded Then
' Highlight current selection
rng.HighlightColorIndex = adverbColor
End If
Loop
' Obtain range again
Options.DefaultHighlightColorIndex = passiveColor
rng.WholeStory
' Set rng = ActiveDocument.StoryRanges.Item(story)
' Do passive word highlighting
rng.Find.ClearFormatting
rng.Find.Replacement.ClearFormatting
rng.Find.Forward = True
rng.Find.Wrap = wdFindContinue
rng.Find.Replacement.Highlight = True
rng.Find.Format = True
rng.Find.MatchCase = False
rng.Find.MatchWholeWord = True
rng.Find.MatchWildcards = False
rng.Find.MatchSoundsLike = False
rng.Find.MatchAllWordForms = False
' Do overused word highlighting (outside quotations only)
Options.DefaultHighlightColorIndex = overusedColor
rng.WholeStory
For Each word In overusedList
rng.Find.Text = word
rng.Find.Wrap = wdFindStop
Do While rng.Find.Execute
rng.Select
If excludeQuotations Then
'from our selection point, work backwards. If the first quote is a start quote,_
'we are inside dialogue, so skip it. If first quote I see is an end quote, we _
'are outside the dialogue tag, so highlight it
Do While Not (Selection.Characters(1) = Chr(147) Or Selection.Characters(1) = Chr(148) Or Selection.Characters(1) = Chr(134))
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Loop
'End Quote or Dagger (start of doc)
If Selection.Characters(1) = Chr(148) Or Selection.Characters(1) = Chr(134) Then
rng.Select
Selection.Range.HighlightColorIndex = clicheColor
End If
Else
Selection.Range.HighlightColorIndex = clicheColor
End If
Loop
Next
' Do misused word/cliche highlighting (only checks outside quotations)
Options.DefaultHighlightColorIndex = clicheColor
rng.WholeStory
For Each word In clicheList
rng.Find.Text = word
rng.Find.Wrap = wdFindStop
Do While rng.Find.Execute
rng.Select
If excludeQuotations Then
'from our selection point, work backwards. If the first quote is a start quote,_
'we are inside dialogue, so skip it. If first quote I see is an end quote, we _
'are outside the dialogue tag, so highlight it
Do While Not (Selection.Characters(1) = Chr(147) Or Selection.Characters(1) = Chr(148) Or Selection.Characters(1) = Chr(134))
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Loop
'End Quote or Dagger (start of doc)
If Selection.Characters(1) = Chr(148) Or Selection.Characters(1) = Chr(134) Then
rng.Select
Selection.Range.HighlightColorIndex = clicheColor
End If
Else
Selection.Range.HighlightColorIndex = clicheColor
End If
Loop
Next
NextRange:
Next
' Restore saved settings
ActiveDocument.TrackRevisions = oldTrack
ActiveDocument.Characters(1).Delete
Options.DefaultHighlightColorIndex = oldHighlight
Application.Run MacroName:="Replace_Smart_Quotes_With_Straight_Quotes"
'Move cursor to beginning of document
Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst
'MsgBox "Word highlighting complete!"
Exit Sub
Err_HighlightWords:
MsgBox Err.Description
End Sub
Pretty cool. I like that it's easy to find the word lists so I can put in my own overused/cliche words that I want to watch out for. I'll have to try it on my next story.
ReplyDeleteThanks!
Thanks WallFlower, this is quite useful.
ReplyDeleteInteresting how "your" code appears to be almost line for line my code :) http://farook.org/macros.htm And I wrote that years ago. It's OK to take stuff and use it but please don't claim to have written stuff when you didn't ...
ReplyDeleteWatch me care.
ReplyDeleteClaiming to be an author and a "programmer" and then passing off other people's code as your own is fine form. What's worse is the fact that you seem to have no shame over your actions .. Plagiarism is plagiarism whether you take other people's code or their writing.
ReplyDeleteHey, I'm a writer. I know exactly what plagiarism is and that it's a serious no-no. And I'm a programmer. We use tons of codes in our programs that are gleaned from what other people wrote, and we give them 0 credit. If you didn't want people to steal it, you shouldn't have made it open source. You should have made people pay for it, if you were going to be so hoity-toity about it. As you can see, it's not exactly the same. I've made some improvements. Besides, I published your comment that pointed to your webpage, and I didn't have to do that. So put a pipe in it.
ReplyDeleteYou seem to be rather misinformed about a lot of things including the English language, courtesy, being a writer, and open source :)
ReplyDeleteFirst of all, you didn't acknowledge the fact that you took my code piecemeal and claimed it was yours. Refer to your own words "I will be posting some of the Macros *I've written*" (emphasis mine). You did not write this macro nor did you make any substantial changes to it. To claim that you wrote the macro is false.
Secondly, you seem to think that publishing my work on my website somehow makes it open source. It doesn't. Look it up. Neither does publishing your story on your website allow others to copy it and publish at as their own.
What I was asking for was some common courtesy. Your lack of courtesy in your responses seems to indicate that you think you did nothing wrong and that you can go around taking other people's work and claiming it as yours. And that is a no-no whether you do it in writing or in code.
You wrote this statement on your Wallflower page: "I've never smoked. I've never used any drugs. No one close to me has died. I have never been arrested. I've never been in a fight. I have never switched schools or majors. I finished college in four years, maintaining the same degree throughout (software engineering). I have never pretended to be something I'm not."
ReplyDeleteThat seems to be quite a jump from someone who would use the work of others. When writing, people cite sources of key points/quotes via a bibliography. There is a standard process for this. Seems to me you could have done a more commendable job in stating you used the work of Fahim as an essential starting point for much of your work.
Even though you say computer code us much of the same, the same can be said of letters/words. You probably should care to give more credit to his work than to merely link.
Speaking of common courtesy, why don't we take a look at what *you* wrote.
ReplyDelete"Interesting how your code appears to be line for line my code. *smiley face*", and then a pleasant link to your website.
For being a writer, you don't know how to use words to get what you want. You could have written a more persuasive note, but instead, you acted like a passive-aggressive, bullying, condescending douche. I mean, seriously, do you just troll the Internet for days and days looking for duplications of some code you wrote years ago? Don't you have better things to do?
You know if you had said "I like the improvements you made on it, but this looks a lot like code I wrote years ago. If it is, would you mind giving me credit and maybe putting on a link to my web page?" I would have been glad to do so. If you're willing to say that, I would be glad to change my terminology and give you credit.
You appear to live in a strange world of your own where everything works the way *you* think it does - you taking somebody else's work and claiming that you wrote it is fine, but me pointing it out to you isn't and is considered bullying. You using insulting words is fine, but me politely pointing stuff out to you is somehow lacking in courtesy :)
ReplyDeleteJust to set the record straight, I was pointed to your page by somebody who knows me and knows of my macro, which is posted on a popular writing-related site. I came, took a look, and contacted you.
I don't really care about the code. But I do care about what people say. And you saying that you wrote it is completely false. But it's up to you whether you wnat to live in denial and believe that you've been wronged. So good luck to you with your further progress in *writing* code and prose :)