Q:

expanding \ref in \write with \classicthesis

The following code:
\documentclass{scrbook}
% \usepackage{classicthesis}

\newwrite\myauxfile
\immediate\openout\myauxfile=test.myaux

\begin{document}

\begin{figure}
  This is a figure
  \caption{This is a caption}
  \label{fig:1}
\end{figure}
Figure~\ref{fig:1}
\write\myauxfile{Figure \ref{fig:1}}
\end{document}

produces a file test.myaux containing the following line:
Figure \relax 0.1\hbox {}

If I include the classicthesis package (uncommenting the second line) The reference number is not expanded and the file test.myaux contains the following line:
Figure \ref  {fig:1}

which is not what I want.  Is it possible to fix this? 

A:

Maybe you want to use \getrefnumber:
\documentclass{scrbook}
\usepackage{classicthesis}
\usepackage{refcount}

\newwrite\myauxfile
\immediate\openout\myauxfile=\jobname.myaux

\begin{document}

\begin{figure}
  This is a figure
  \caption{This is a caption}
  \label{fig:1}
\end{figure}
Figure~\ref{fig:1}
\write\myauxfile{Figure \getrefnumber{fig:1}}
\end{document}

The new aux file will contain
Figure 1

