%% open slidelist file
\AtBeginDocument{
  \newwrite\slidelist
  \immediate\openout\slidelist=slidelist.txt
}
%% close file
\AtEndDocument{
  \immediate\closeout\slidelist
}

%% redefine \begin{frame}
\let\oldframe\frame
% tmp counter
\newcount\slidecount
\def\frame{
  % the actual page number should be 1 less than \thepage
  \slidecount=\thepage
  \advance\slidecount by-1
  % only write if the page number is positive
  \ifnum\the\slidecount>0
    \immediate\write\slidelist{\thepage}
  \fi
  \oldframe
} 

