Friday, May 15, 2009
Thursday, May 7, 2009
Platypus for easier Statute Navigation
Mike and I have mentioned the power of Greasemonkey here before. It can really be an amazing tool in customizing your web browsing, but also making your life as a lawyer easier. Today I was browsing through the Rules of Civil Appellate Procedure chapter of the code (fun, right?) at around the Length of Briefs section (66) of the nearly 100 sections therein - and in light of the fact that I knew I'd find myself on this very page again several times over the next few months or so - I knew there had to be an easier way to find what I'm looking for.
Of course when you're dealing with a specific, commonly used webpage a bookmark is always an option. However Ctrl+D was not what I was after today. Enter Platypus. Frankly, I don't remember if I've mentioned Platypus before or not, but if I had I would have told you it is a robust add-on for firefox that creates on-the-fly greasemonkey extensions which customize the way any given page appears and tailors them to your specific needs.
I knew that for my issue I was going to be coming back to this page over and over again and that I would want to easily find specific sections for reference. Using Platypus I was able to highlight sections that I knew I would want to reference later as well as highlight and bold the really important ones. For example, References in Briefs to Parties, congratulations, you are important to me and you are hereby hilighted. However, Mr. Printing and Binding Specifications for Briefs, you are very important to me (owing to my experience in having a brief kicked back because one paragraph, one paragraph, was improperly aligned) and you are therefore now highlighted and bold.
Here's a side-by-side before and after of the page:
As you can see, the links on the left run together and unless you know the specific section number off the top of your head, you're going to be reading titles. On the right however, your eye quickly jumps to the sections that you have designated.
Platypus is simple to use. Once you've installed the extension you simply right click on any page that you want to customize and select Platypus! from the context menu.
You will initially notice that areas of the page are turned red when you run your mouse over them. These are areas that are editable on the page. If there is one weakness to Platypus it's that you are at the mercy of the code and layout used by the designer as far as areas that are editable. The SD Statute Chapters are a good example. It would be much more desireable to highlight the entire title of the individual section along with its link, but because of the way the HTML of the page is rendered that's not an easy option in this instance. To edit the style of an area mouse over an editable area and right click again. Now you're looking at the Platypus context menu.
There are several options and they can all be valuable depending on what you want to do on a page. In this instance we want to edit the style of the page so click Set Style. A new menu will pop up with several options. To highlight find the Background Color and select yellow (or your choice), if your done click Accept, to preview click Apply. If you want to make the text of an area bold that's under the Font Weight option.
Once you've made and accepted your changes it is very important that you Save your changes. Before navigating away from the page your editing click Save and Exit Platypus on the Platypus Context Menu. A greasemonkey script will (should) then install and your changes are saved.
Sunday, April 12, 2009
MOTD: Auto-update the date
In my template, I inserted a date field by going to Word's Insert tab
and clicking Quick Parts
and then selecting Date from the Field names list (you can use SaveDate if you want - see this post for more about the SaveDate field). The Date field displays the current date. The Date formats box is used to control how the date is displayed. The box uses a code system; "d" stands for day, "M" stands for month, "y" stands for year, "h" stands for hour, "m" stands for minute, and "s" stands for second. Note that you capitalize M for month because lower case m stands for minute. The formating is a little difficult to explain so examples are the only way to go. If you want the date to be formatted like "3/15/09", type M/d/yy. For "3/15/2009," type M/d/yyyy. For "Sunday, March 15, 2009," type dddd, MMMM dd, yyyy. Most of the common formats are in the list so you don't generally need to figure the formatting out. However, I want to do something out of the ordinary. I want the document to read something like "Executed on the 1st," so clear out the Date formats box and just place a "d" there. Right after the Date box we just inserted, insert a MacroField by selecting MacroField from the Field names list. In the Display text box put something like "st" (because this box will say "st", "nd", or "rd"). In the Macro name box just leave the default there (AcceptAllChangesInDoc) because we will add our own Macro next. Your document looks something like this:
Click on the "st" and type Shift + F9. This will expand the MacroField to display its code. Replace AcceptAllChangesInDoc with DateSuperScript - the name of the macro we will make next.
I want the month and the year at the end so I insert a second Date field using the code MMMM, yyyy.
The finished product looks like this:
Now type Alt + F11 to open up the Visual Basic editor. Then select the Project template for your document in the project window (it will have the name of your Word document). Expand the project. Expand the Microsoft Word Objects tab and select the ThisDocument icon and then paste this code in the document:
Sub AutoSuperScript()
Dim oStory As Range
Dim oField As Field
For Each oStory In ActiveDocument.StoryRanges
For Each oField In oStory.Fields
If InStr(1, oField.Code.Text, " MACROBUTTON DateSuperscript") Then
oField.Code.Text = " MACROBUTTON DateSuperscript " + GetDateSuperscript
End If
oField.Update
Next oField
Next oStory
End Sub
Private Sub Document_New()
AutoSuperScript
End Sub
Private Function GetDateSuperscript()
'1-> st
'2->nd
'3->rd
'0, >3 ->th
strDt = Str(Day(Now))
strEnd = Right(strDt, 1)
If strEnd = 1 Then
GetDateSuperscript = "st"
ElseIf strEnd = 2 Then
GetDateSuperscript = "nd"
ElseIf strEnd = 3 Then
GetDateSuperscript = "rd"
Else
GetDateSuperscript = "th"
End If
End Function
Now every time you create a new document from your template the date will be updated. If you really want to get wild, add the AutoSuperScript function to the UpdateAll function I talked about in this post. That way, the superscript will get updated every save.
Sunday, April 5, 2009
MOTD: Print Current Page Shortcut
Sub PrintCurrent()
'
' PrintCurrent Macro
' Macro recorded 3/9/2009 by Michael Shubeck
'
Application.PrintOut FileName:="", Range:=wdPrintCurrentPage, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End Sub
Sunday, March 29, 2009
MOTD: Insert Merge Field
Sub InsertMergeField() 'ALT CTRL M
'
' InsertMergeField Macro
' Macro recorded 3/13/2009 by Michael Shubeck
'
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"MERGEFIELD INSERT ", PreserveFormatting:=True
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Fields.ToggleShowCodes
End Sub
Sunday, March 22, 2009
Macro of the Day (MOTD): Keybord Shortcut For Envelope Printing
In the Project window on the left side of the Visual Basic editor, open up the Normal tab and the Microsoft Word Objects tab under that. Double click on the ThisDocument icon. Paste the following code in.
Sub PrintEnvelope()
'
' PrintEnvelope Macro
' Macro recorded 3/10/2009 by Michael Shubeck
'
ActiveDocument.Envelope.PrintOut ExtractAddress:=False, OmitReturnAddress _
:=True, PrintBarCode:=False, PrintFIMA:=False, Height:=InchesToPoints( _
4.13), Width:=InchesToPoints(9.5), Address:=Selection.Text, AutoText _
:="ToolsCreateLabels3", ReturnAddress:= _
"The Law Offices of Gregory A. Yates", ReturnAutoText:= _
"ToolsCreateLabels2", AddressFromLeft:=wdAutoPosition, AddressFromTop:= _
wdAutoPosition, ReturnAddressFromLeft:=wdAutoPosition, _
ReturnAddressFromTop:=wdAutoPosition, DefaultOrientation:=wdLeftLandscape _
, DefaultFaceUp:=False, PrintEPostage:=False
End Sub
Now lets hook the macro up to a keyboard shortcut. In Word 2007, click on the Office Button
Now you can highlight a person's address in your document, use your shortcut, and the envelope will print.
As a final note, watch out where the envelpe prints if you have multiple printers installed. The envelope will print to the printer listed in the print menu.
Sunday, March 15, 2009
MOTD: Autoupdate fields on save
I use templates for all of my commonly used documents, from my basic letter or fax template to more complex pleading documents. I have discussed how to create templates before. Word allows you to insert blanks called fields in a document. These fields will automatically fill in information at certain times. In many of my templates I have fields that automatically fill in the date or generate tables of contents, among other things. These fields all need to be manually updated by right clicking on them and clicking update. Sometimes I forget to update the field before printing so I created a macro to automatically update the fields when I hit the save button. Credit goes to these blog posts: 1, 2.
For experimentation, create a template using the procedures from the creating templates tutorial. Then insert a save date field in that template. In Office 2007, you go to the Insert tab on the Ribbon bar
. Next, go to the Quick Parts button
. Then select the Field menu item. 
In the Field dialog, select SaveDate. Select whatever date format you desire.
A SaveDate field displays the date the document was saved (after it is updated) and, thus, is handy for letters and other documents that are printed and sent on the date they are saved.
Now lets bring up the Visual Basic editor so we can start adding some code, type Alt + F11. In the Project window on the left, find the letter project and right click on it. Next click insert -> module.
A new item called a code module will be inserted under your project in a modules folder. It will be named Module1.
Now insert a new class module just like you inserted the code module. The class module will be named Class1.
Your Project window should look like this:
The specifics of what ThisDocument, Module1, and Class1 are not very important at this point so I wont go into detail. We will just paste code to make things work. If you have a desire to understand code, see here.
Double click on the ThisDocument icon in the Project window. Now paste the following code into the code window:
Private Sub Document_New() 'has to be Document_New not Document_Open for it to work in a template
Call Register_Event_Handler
End Sub
Now double click on the Module1 icon and paste this code in:
Dim X As New Class1
Public Sub Register_Event_Handler()
Set X.App = Word.Application
End Sub
Finally, paste this code into Class1:
Public WithEvents App As Word.Application
Private Sub App_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean)
UpdateAll
End Sub
Sub UpdateAll()
Dim oStory As Range
Dim oField As Field
Dim bSaveDate As Boolean
bSaveDate = False
On Error Resume Next
For Each oStory In ActiveDocument.StoryRanges
For Each oField In oStory.Fields
If oField.Type = wdFieldSaveDate Then
bSaveDate = True
End If
oField.Update
Next oField
Next oStory
If bSaveDate = True Then
MsgBox "Save a second time to update a save date field"
End If
On Error GoTo 0
End Sub
SaveDate fields present a special paradox. The document has to be saved before the field can be updated. I have the following code to remind me to press save twice to update the field:
If bSaveDate = True Then
MsgBox "Save a second time to update a save date field"
End If
Now save the template and double click on the template file to create a new document using that template. When you hit save the message box will remind you to save a second time, and when you do, the date field will be updated automatically.
This same code will automatically update tables of contents, numbering and any other Word field that automatically generates information.




