|
25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more... |
Home Projects Up Sitemap Search Blog Forum+Chat About Us Privacy Terms of Use Feedback FAQ Images Services Ads Donate Humor |
Microsoft Word 6.0 WordBasic macro that zeroes bit 8 (parity) of all bytes in a file so all chars have ASCII values < 128. For cleaning up log files of modem sessions or converting WordStar files.
Zeroes bit 8 (parity) of all characters in file so all chars have ASCII values < 128.
For cleaning up log files of modem sessions.
Sub MAIN
REM Copyright (C)1999 Steven Whitney.
REM Initially published by http://25yearsofprogramming.com.
REM Published under GNU GPL (General Public License) Version 2, with ABSOLUTELY NO WARRANTY.
REM ZEROES HIGH BIT (PARITY) OF ALL CHARS IN FILE
REM SO ALL CHARS HAVE ASCII VALUES < 128.
REM You should normally run this macro FIRST (before any control char
REM handling) on a newly imported file.
REM
REM DUE TO SOME AUTOMATIC FORMATTING DURING EDITCLEAR(),
REM THIS MACRO DOES *NOT* DO *ONLY* THE PARITY STRIPPING,
REM PRESERVING THE INTEGRITY OF THE ORIGINAL FILE,
REM IF THAT IS WHAT YOU NEED, USE MAPDOWN.EXE.
REM 11-26-99
REM ----------------------------------------------------------------------------
If MsgBox("Run this macro only on a file freshly imported from text into MSWord. Also, a better choice is the program MAPDOWN.EXE. Continue anyway?", 36) <> - 1 Then Goto bye
REM ---------------------------------------------------------------------
REM SECTION NOT NOW USED. MACRO NOW *DOES* CONVERT THESE CHARS.
REM DON'T CONVERT CERTAIN CHARS USED BY MSWORD. SEE CLEANSTRING$() HELP.
REM If a <> 160 And a <> 172 And a <> 176 And a <> 182 And a <> 183 Then
REM EndIf
REM ---------------------------------------------------------------------
StartOfDocument
While Not AtEndOfDocument()
a = Asc(Selection$())
If a > 127 Then
REM IT ONLY WORKS RIGHT IF YOU INSERT FIRST, THEN DELETE.
REM OTHERWISE, SOME SPACES BETWEEN WORDS GET REMOVED ENTIRELY.
REM 'AND' IS MUCH FASTER THAN A - 128
Insert Chr$(a And 127) 'INSERT ORIGINAL AT LEFT
EditClear 'REMOVE ORIGINAL CHAR
Else
CharRight
EndIf
Wend
StartOfDocument
REM ---------------------------------------------------------------------
bye:
End Sub
|
|
|
|
|
|