Skip to content

Commit

Permalink
Fix more typos (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mo-Gul authored Oct 17, 2021
1 parent 052a377 commit 34ebb77
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 39 deletions.
14 changes: 9 additions & 5 deletions QuoteFixMacro.bas
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Attribute VB_Name = "QuoteFixMacro"

' For information on configuration head to QuoteFix Macro's homepage: https://macros4outlook.github.io/quotefixmacro/

'@Folder("QuoteFixMacro")
Option Explicit


Expand All @@ -41,6 +42,7 @@ Private Const REG_GROUP_FIRSTNAMES As String = "Firstnames" 'stores replacements
'*** Feature QuoteColorizer ***
'--------------------------------------------------------
Private Const DEFAULT_USE_COLORIZER As Boolean = False
'TODO: add note where to get the DLL from. I couldn't find it on my system
'If you enable it, you need MAPIRTF.DLL in C:\Windows\System32
'Does NOT work at Windows 7/64bit Outlook 2010/32bit
'
Expand Down Expand Up @@ -117,8 +119,8 @@ Private Const DEFAULT_CONDENSED_HEADER_FORMAT As String = "%SN wrote on %D:"


Private Const OUTLOOK_PLAIN_ORIGINALMESSAGE As String = "-----"
'Private Const OUTLOOK_PLAIN_ORIGINALMESSAGE = "-----Ursprüngliche Nachricht-----"
'Private Const OUTLOOK_PLAIN_ORIGINALMESSAGE = "-----Original Message-----"
'Private Const OUTLOOK_PLAIN_ORIGINALMESSAGE As String = "-----Ursprüngliche Nachricht-----"
'Private Const OUTLOOK_PLAIN_ORIGINALMESSAGE = As String "-----Original Message-----"
Private Const OUTLOOK_ORIGINALMESSAGE As String = "> " & OUTLOOK_PLAIN_ORIGINALMESSAGE
Private Const PGP_MARKER As String = "-----BEGIN PGP"
Private Const OUTLOOK_HEADERFINISH As String = "> "
Expand Down Expand Up @@ -158,14 +160,16 @@ Private FIRSTNAME_REPLACEMENT__EMAIL() As String
Private FIRSTNAME_REPLACEMENT__FIRSTNAME() As String


'TODO: 1: check if these can also be changed into `Long`s. Unfortunately I
' don't have the DLL and therefore can't test it myself
'For QuoteColorizer
Public Declare PtrSafe Function WriteRTF _
Lib "mapirtf.dll" _
Alias "writertf" (ByVal ProfileName As String, _
ByVal MessageID As String, _
ByVal StoreID As String, _
ByVal cText As String) _
As Integer
As Integer ' <-- {1}

'For QuoteColorizer
Public Declare PtrSafe Function ReadRTF _
Expand All @@ -174,7 +178,7 @@ Public Declare PtrSafe Function ReadRTF _
ByVal SrcMsgID As String, _
ByVal SrcStoreID As String, _
ByRef MsgRTF As String) _
As Integer
As Integer '<-- {1}


Private Enum ReplyType
Expand Down Expand Up @@ -1512,7 +1516,7 @@ Public Function ColorizeMailItem(MyMailItem As MailItem) As String
Dim rtf As String
rtf = Space$(99999) 'init rtf to max length of message!

Dim ret As Integer
Dim ret As Integer '<-- {1}
ret = ReadRTF(session.CurrentProfileName, MyMailItem.EntryID, folder.StoreID, rtf)
If (ret = 0) Then
'ole call success!!!
Expand Down
30 changes: 17 additions & 13 deletions QuoteFixWithPAR.bas
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Attribute VB_Name = "QuoteFixWithPAR"

' For information on QuoteFixMacro heat to: https://macros4outlook.github.io/quotefixmacro/

'@Folder("QuoteFixMacro")
Option Explicit

Private Const PAR_OPTIONS As String = "75q" 'DEFAULT=rTbgqR B=.,?_A_a Q=_s>|
Expand All @@ -26,9 +27,9 @@ Private Declare PtrSafe Function abLstrcpy Lib "Kernel32" Alias "lstrcpyA" (ByVa
Private Declare PtrSafe Function abGlobalFree Lib "Kernel32" Alias "GlobalFree" (ByVal hMem As Long) As Long
Private Declare PtrSafe Function abGlobalSize Lib "Kernel32" Alias "GlobalSize" (ByVal hMem As Long) As Long

Private Const GHND = &H42
Private Const CF_TEXT = 1
Private Const APINULL = 0
Private Const GHND As Long = &H42
Private Const CF_TEXT As Long = 1
Private Const APINULL As Long = 0


Private Function ExecPar(ByVal mailtext As String) As String
Expand Down Expand Up @@ -89,16 +90,19 @@ Public Sub ReformatSelectedText()
End Sub


Private Function Text2Clipboard(szText As String)
'TODO: 2: add `ByVal` or `ByRef` (default is `ByRef`). `szText` is changed
' in the marked line and thus goes (maybe) changed to the calling
' procedure. (Is that intended?)
Private Sub Text2Clipboard(szText As String)
' Get the length, including one extra for a CHR$(0) at the end.
Dim wLen As Long
wLen = Len(szText) + 1
szText = szText & Chr$(0)
szText = szText & Chr$(0) '<-- {2}
Dim hMemory As Long
hMemory = abGlobalAlloc(GHND, wLen + 1)
If hMemory = APINULL Then
MsgBox "Unable to allocate memory."
Exit Function
Exit Sub
End If
Dim wFreeMemory As Boolean
wFreeMemory = True
Expand Down Expand Up @@ -134,19 +138,19 @@ T2CB_Close:
MsgBox "Unable to close the Clipboard."
End If
If wFreeMemory Then GoTo T2CB_Free
Exit Function
Exit Sub

T2CB_Free:
If abGlobalFree(hMemory) <> APINULL Then
MsgBox "Unable to free global memory."
End If
End Function
End Sub


Private Function Clipboard2Text()
Private Sub Clipboard2Text()
If abIsClipboardFormatAvailable(CF_TEXT) = APINULL Then
Clipboard2Text = Null
Exit Function
Exit Sub
End If

If abOpenClipboard(0&) = APINULL Then
Expand All @@ -158,7 +162,7 @@ Private Function Clipboard2Text()
hMemory = abGetClipboardData(CF_TEXT)
If hMemory = APINULL Then
MsgBox "Unable to retrieve text from the Clipboard."
Exit Function
Exit Sub
End If
Dim wSize As Long
wSize = abGlobalSize(hMemory)
Expand Down Expand Up @@ -189,10 +193,10 @@ CB2T_Close:
MsgBox "Unable to close the Clipboard."
End If
If wFreeMemory Then GoTo CB2T_Free
Exit Function
Exit Sub

CB2T_Free:
If abGlobalFree(hMemory) <> APINULL Then
MsgBox "Unable to free global clipboard memory."
End If
End Function
End Sub
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ See what I mean?

Now, what is wrong with this email?

* Horribly broken quotes - line breaks in several wrong places!
* Horribly broken quotes line breaks in several wrong places!
* Outlook basically forced me to do a 'top-post', because empty lines were inserted at the top and the cursor was positioned there. And if I had used a signature, it would have been inserted at the top, too.
* Empty lines at the end of the message were quoted.
* The quote header is far too long (5 lines + 2 empty lines) and cannot be modified for a 'personal touch'.

BUT... It doesn't have to be that way. QuoteFixMacro fixes all of the above - and more! The following is an example of how the above message dialog could have looked with QuoteFixMacro:
BUT... It doesn't have to be that way. QuoteFixMacro fixes all of the above and more! The following is an example of how the above message dialog could have looked with QuoteFixMacro:

```text
Dominik Jain wrote:
Expand All @@ -86,7 +86,7 @@ Dominik Jain wrote:
See what I mean?
```

And the best thing about QuoteFixMacro is, **there is absolutely nothing you have to do**. It's all done automatically. You click reply and Outlook-QuoteFix will immediately reformat the message for proper quoting! No message you send is ever going to look like the one in the example at the top again... And if you get all your friends to use this program, too, such messy quotes will soon become the exception to the rule. And even if you don't, QuoteFixMacro will attempt to fix all their messy quotes when you reply to their messages!
And the best thing about QuoteFixMacro is, **there is absolutely nothing you have to do**. It's all done automatically. You click reply and QuoteFixMacro will immediately reformat the message for proper quoting! No message you send is ever going to look like the one in the example at the top again... And if you get all your friends to use this program, too, such messy quotes will soon become the exception to the rule. And even if you don't, QuoteFixMacro will attempt to fix all their messy quotes when you reply to their messages!

## Setup

Expand All @@ -100,7 +100,7 @@ Download the latest version from the GitHub release page.
2. In Outlook's VBA editor (<kbd>Alt</kbd>+<kbd>F11</kbd> or "Tools > Macro > Visual Basic-Editor"), import `QuoteFixMacro.bas` by right-clicking on "Modules" and selecting "Import...".
3. If you don't want to get a security warning when you use the macros, go to "Tools > Macro > Security" and disable the security check. A better solution is to sign the macro. See "Signing a Macro" below.

Pro tip: In case you want to try out the current "random signature generation", import `RandomSignature.bas`. The `QuoteFixWithPAR.bas` is not ready for testing yet. - You can easily import all files at once by dragging them from the Explorer into the VBA editor and dropping them onto the project tree.
Pro tip: In case you want to try out the current "random signature generation", import `RandomSignature.bas`. The `QuoteFixWithPAR.bas` is not ready for testing yet. You can easily import all files at once by dragging them from the Explorer into the VBA editor and dropping them onto the project tree.

### Assign macros to buttons

Expand All @@ -112,18 +112,19 @@ After that, you need to replace the original "Reply" and "ReplyAll" buttons with

You can also change the name and image of the newly created buttons using the customization dialog. If you use "Fixed&Reply" as the name, <kbd>Alt</kbd>+<kbd>R</kbd> is kept as a shortcut for reply. Since Outlook does not support custom keybindings, you cannot map the shortcut <kbd>Ctrl</kbd>+<kbd>R</kbd> to the new FixedReply macro. Nevertheless, the mapping can be done by using AutoHotkey (see below).

### Set up eMail
### Set up email

1. Tools > Options > Preferences > E-mail Options... > On replies and forwards

* When replying to a message: "Prefix each line of the original message"
* When forwarding a message: "Include original message text" or "Prefix each line of the original message"
<!-- markdownlint-disable-next-line MD038 -->
* Prefix each line with: "`> `"

2. Tools > Options > Mail Format

* Message format: Plain Text
* Not this is not necessary, if `CONVERT_TO_PLAIN` is set to `True`.
* Note: this is not necessary, if `CONVERT_TO_PLAIN` is set to `True`.

3. Tools > Options > Mail Format > Internet Format...

Expand All @@ -138,14 +139,14 @@ You can also change the name and image of the newly created buttons using the cu
5. Display all E-Mail as Text

* QuoteFixMacro requires plain text to work. One can either read all emails as plain text from the beginning or set `CONVERT_TO_PLAIN` is set to `True`.
In case all texts should be read a s plain text,s ee Microsoft [KB 831607](https://support.microsoft.com/en-us/office/change-the-message-format-to-html-rich-text-format-or-plain-text-338a389d-11da-47fe-b693-cf41f792fefa?ui=en-us&rs=en-us&ad=us) for an explanation how to turn on this feature. For Outlook 2010 and later (also described at ["Read email messages in plain text"](https://support.microsoft.com/en-us/office/read-email-messages-in-plain-text-16dfe54a-fadc-4261-b2ce-19ad072ed7e3?ui=en-US&rs=en-US&ad=US)): File / Options / Security Center / Options for the Security Center / E-Mail Security / "Read as Plain Text" / `[X]` Read all standard mail in plain text, `[X]` Read all digitally signed mail in plain text".
In case all texts should be read as plain text, see Microsoft [KB 831607](https://support.microsoft.com/en-us/office/change-the-message-format-to-html-rich-text-format-or-plain-text-338a389d-11da-47fe-b693-cf41f792fefa?ui=en-us&rs=en-us&ad=us) for an explanation how to turn on this feature. For Outlook 2010 and later (also described at ["Read email messages in plain text"](https://support.microsoft.com/en-us/office/read-email-messages-in-plain-text-16dfe54a-fadc-4261-b2ce-19ad072ed7e3?ui=en-US&rs=en-US&ad=US)): File > Options > Security Center > Options for the Security Center > E-Mail Security > "Read as Plain Text" > `[X]` Read all standard mail in plain text, `[X]` Read all digitally signed mail in plain text".

## Templates

Templates are **the** place to take full advantage of QuoteFixMacro.
The macro replaces certain tokens in the signature. Therefore, the signature can also be used as a template for a message.

Please double check that the template is used as "Forward/Reply" signature under Extra.../Options/E-Mail-Format/Signatures.../E-Mail-Signature
Please double check that the template is used as "Forward/Reply" signature under Extra... > Options > E-Mail-Format > Signatures... > E-Mail-Signature

| Pattern | Description |
| -- | -- |
Expand Down Expand Up @@ -205,12 +206,12 @@ Amie

### Custom first names

Sometimes, one wants to call someone by a nick name. E.g., one wants to call "Jennifer Muster" just "Jenny". Sometimes, someone does not put his full first name in the Email. E.g., "Adelinde Muster" has "<[email protected]>".
Sometimes, one wants to call someone by a nick name. E.g., one wants to call "Jennifer Muster" just "Jenny". Sometimes, someone does not put his full first name in the email. E.g., "Adelinde Muster" has "<[email protected]>".

QuoteFixMacro supports that replacement. You have to use the registry keys at `HKEY_CURRENT_USER\Software\VB and VBA Program Settings\QuoteFixMacro\firstnames`.
The key `Count` states how many entries you made.
`HKEY_CURRENT_USER\Software\VB and VBA Program Settings\QuoteFixMacro\firstnames\1` contains the first entry, `...\2` the second, and so on.
At each entry, there are two keys: email stating the email to match and firstName the first name to use.
At each entry, there are two keys: `email` stating the email to match and `firstName` the first name to use.

#### Step-by-step instruction

Expand All @@ -219,13 +220,13 @@ At each entry, there are two keys: email stating the email to match and firstNam
1. Create key `firstnames`
1. Create string (!) "Count" with value `X`, where `X` is the number of replacements you want to configure
1. Create key `firstnames.1`
1. Create string value `email` with the email you want to specify a firstName for
1. Create string value `firstName` with the firstname to be used
1. Create string value `email` with the email you want to specify a first name for
1. Create string value `firstName` with the first name to be used
1. Repeat steps 5 to 7 until `X` is reached. Replace `1` at `firstnames.1` by the appropriate number

#### Direct import using `.reg` files

Alternatively, create a `example.reg` file with following content and adapt it to your needs. Then double click on "example.reg" and import it into your registry.
Alternatively, create an `example.reg` file with following content and adapt it to your needs. Then double click on "example.reg" and import it into your registry.
The distribution of QuoteFixMacro already contains an [`exampleFirstNameConfiguration.reg`](exampleFirstNameConfiguration.reg) with the content below.

```reg
Expand Down Expand Up @@ -308,14 +309,14 @@ One can also condense the first header only `CONDENSE_FIRST_EMBEDDED_QUOTED_OUTL

### QuoteColorizer

QuoteColorizer colorizes the indented parts in different colors to make it easier to distinguish who wrote which text. Set `USE_COLORIZER` to `true` to use this. The mail format is automatically set to Rich-Text.
QuoteColorizer colorizes the indented parts in different colors to make it easier to distinguish who wrote which text. Set `USE_COLORIZER` to `True` to use this. The mail format is automatically set to Rich-Text.

The recipient will receive the colors, too.
In case, you don't want this, enable convert RTF-to-Text at sending.

### Strip sender's signature

By default, the sender's signature is removed from the reply. If you don't want this, set `STRIP_SIGNATURE` to `false`.
By default, the sender's signature is removed from the reply. If you don't want this, set `STRIP_SIGNATURE` to `False`.

### SoftWrap

Expand Down Expand Up @@ -343,7 +344,7 @@ You can store the default configuration in the registry:
2. by writing a routing executing command similar to the following: `Call SaveSetting(APPNAME, REG_GROUP_CONFIG, "CONVERT_TO_PLAIN", "true")`
3. by manually creating entries in this registry hive: `HKEY_CURRENT_USER\Software\VB and VBA Program Settings\QuoteFixMacro`

### Intersept the normal buttons
### Intercept the normal buttons

Add the content of `ThisOutlookSession.cls` to 'ThisOutlookSession' in the Outlook Visual Basic Macro Editor after having installed QuoteFixMacro and restart Outlook.
You can then use the normal Reply/ReplyAll/Forward buttons.
Expand All @@ -356,6 +357,7 @@ It should also work if the reply event is triggered otherwise (e.g. by another m
## FAQ

Q: What if the whole mail text disappears?
<!-- markdownlint-disable-next-line MD038 -->
A: The reply setting in Outlook is not configured as required. Double check that the original text should be prefixed with `> `.

## Developing
Expand Down
2 changes: 2 additions & 0 deletions RandomSignature.bas
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Attribute VB_Name = "RandomSignature"

'@Folder("QuoteFixMacro")
Option Explicit

Public Sub NewMailMessage()
Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions Tools.bas
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Attribute VB_Name = "Tools"
'
'$Revision$ - not released

'@Folder("QuoteFixMacro")
Option Explicit

Public InterceptorCollection As New Collection
Expand All @@ -44,7 +45,7 @@ Public Sub ReadCurrentMailItemRTF()
Dim rtf As String
rtf = Space$(99999)
Dim ret As Long
ret = ReadRTF("MAPI", GetCurrentItem.EntryID, Session.GetDefaultFolder(olFolderInbox).StoreID, rtf)
ret = ReadRTF("MAPI", GetCurrentItem.EntryID, session.GetDefaultFolder(olFolderInbox).StoreID, rtf)
rtf = Trim$(rtf)

Debug.Print "RTF READ:" & ret & vbCrLf & rtf
Expand All @@ -61,10 +62,10 @@ Public Sub TestColors()
Set answer = mi.reply
Set mi = Nothing

answer.BodyFormat = olFormatRichText
answer.bodyFormat = olFormatRichText

Dim mid As String
'mid = QuoteColorizerMacro.ColorizeMailItem(answer)
Dim ColoredAnswer As String
'ColoredAnswer = QuoteColorizerMacro.ColorizeMailItem(answer)
answer.Display
Set answer = Nothing 'answer bodyformat changes here to 1 for some stupid reason...

Expand Down
2 changes: 1 addition & 1 deletion tests/QuoteFixMacroTest.bas
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Option Explicit
Option Private Module

'@TestModule
'@Folder("Tests")
'@Folder("QuoteFixMacro.Tests")

Private Assert As Object
Private Fakes As Object
Expand Down

0 comments on commit 34ebb77

Please sign in to comment.