Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WP8 Macro to cleanup DOS txt

Status
Not open for further replies.

eamc

Technical User
Sep 3, 2001
83
US
I often copy text full of [font] and other codes, short lines, [EOL] codes, etc. and paste it into WP8. I have written a macro (below) that cleans it up, and organizes it into paragraphs separated by the original [HRt][HRt] codes. This macro WORKS FINE, but keeps running forever, and has to be stopped with the ESC key. It tells you which line is at fault, but gives different numbers at different times.
In spite of the many BEEPs, I only hear one beep. What am I doing wrong:

//Macro: DOSCLEA3
//If retrieve ASCII doc with CR>SRt, this cleans it up
// Hunts first for [HRt][HRt] as para separator, then [HRt] [HRt]
// USE OnNotFound BEFORE EVERY SEARCH OR REPLACE!!
// also gets rid of triple-[HRt] repetitively

Application(WordPerfect; "WordPerfect";Default!; "EN")
//Display(Off!)

PosDocTop
OnNotFound(x1)
SearchString(""+" "+"")
ReplaceString(""+""+"")
ReplaceForward()

LABEL(x1)
PosDocTop Beep ()
Beep (BeepType:Exclamation!)

OnNotFound(x2)
SearchString(""+"")
ReplaceString("")
ReplaceForward()

LABEL(x2)
PosDocTop Beep Beep ()
Beep ()
Beep ()
Beep (BeepType:Exclamation!)
OnNotFound(k1)
ReplaceConfirm(No!)
SearchString(""+""+"")
ReplaceString("~~")
ReplaceForward()

Label(k1)
PosDocTop Beep Beep Beep()
Beep (BeepType:Exclamation!)
OnNotFound(x3)
SearchString(""+"")
ReplaceString(" ")
ReplaceForward()

LABEL(x3)
PosDocTop Beep ()
Beep (BeepType:Exclamation!)
SearchString("~~")
ReplaceString(""+""+"")
ReplaceForward()

PosDocTop Beep ()
OnNotFound(BB)
SearchString("[Image]")
ReplaceString("")
ReplaceForward()
Label(BB)

Label(AA)
PosDocTop
OnNotFound(X4)
SearchString(" ")
ReplaceString(" ")
ReplaceForward(Regular!)
//PosDocTop ()
Go(AA)

LABEL(X4)
PosDocTop Beep ()
Beep (BeepType:Exclamation!)
OnNotFound(X5)
SearchString(""+" ")
ReplaceString(""+"")
ReplaceForward()

LABEL(X5)
PosDocTop Beep ()
OnNotFound(X6)

SearchString(""+""+""+"")
ReplaceString(""+""+"")
ReplaceForward()
Go(X5)

LABEL(X6)
Beep () Beep () Beep () Beep ()
Beep (BeepType:Exclamation!)
Beep (BeepType:Exclamation!)
Beep (BeepType:Exclamation!)
Quit




Edwin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top