                                                   \makeatletter
\typeout{^^J*fdtxttex.tex* 2010/03/22 txt to TeX by dialogue^^J
             (apply \string\MakeDocCorrectHook)
                                                            ^^J}

\RequirePackage{fifinddo}

\def\MakeDocCorrectHook#1{#1}
\catcode`\_=11 
\def\CorrectionFile{\def\mdoc_corr}
\CorrectionFile{mdoccorr.cfg}
\ResultFile{sample.tex}
\def\InputFile{\def\input_file_name}
\InputFile{sample.txt}
\newif\iftoscreen

\def\FD_dialogue{%
  \typeout{^^J%
    ===========================================================^^J%
    \string\CorrectionFile{\mdoc_corr} 
    \space (define \@backslashchar MakeDocCorrectHook)^^J%
    \string\InputFile {\input_file_name}^^J% 
    \string\ResultFile{\result_file_name} 
    \space\space\space\space\space\space\space
    \string\toscreen\iftoscreen true\else false\fi             ^^J%
    ===========================================================%
  }%
  \typein[\action]%
         {Run with these settings? (Y)es? (C)hange? (Otherwise quit.)}% 
  \csname action_\action \endcsname 
}
\def\run_with_settings{%
  \input{\mdoc_corr}%
  \WriteProvides
  \ProcessFileWith{\input_file_name}{%
    \WriteResult{\expandafter \MakeDocCorrectHook 
                 \expandafter{\fdInputLine}}%
    \iftoscreen
      \typeout{\expandafter \MakeDocCorrectHook 
                 \expandafter{\fdInputLine}}%
    \else
      \message{.}%
    \fi}
  \CloseResultFile
  \typeout{Done.}%
  \FD_dialogue
} 
\expandafter\let\csname action_y\endcsname \run_with_settings
\expandafter\let\csname action_Y\endcsname \run_with_settings

\def\change_settings{%
    \typein[\change]{^^JType setting command(s).}%
    \change \FD_dialogue}
\expandafter\let\csname action_c\endcsname \change_settings
\expandafter\let\csname action_C\endcsname \change_settings

\FD_dialogue

\stop
