\def\IllustPageS{%
  \newwrite\outputfileIP
  \immediate\openout\outputfileIP=illust-page.txt\relax
  \newcount\@totalpageIlst
  \@totalpageIlst=\@totalpage
  \advance\@totalpageIlst-1
  \immediate\write\outputfileIP{s \number\@totalpageIlst}}

\def\IllustPagePf{%
\@totalpageIlst=\@totalpage
\advance\@totalpageIlst1
\immediate\write\outputfileIP{p \number\@totalpageIlst}}

\def\IllustPageP{%
\@totalpageIlst=\@totalpage
\advance\@totalpageIlst-1
\immediate\write\outputfileIP{p \number\@totalpageIlst}}

\def\IllustPageE{%
\@totalpageIlst=\@totalpage
\advance\@totalpageIlst-1
\immediate\write\outputfileIP{e \number\@totalpageIlst}
\immediate\closeout\outputfileIP}
