I have removed Numberstring from the macro altogether for the time being, and just defined \temp as follows:
Code: Select all
\def\temp{#2}
Code: Select all
\CheckCountAssign{SomeMacro}{MacroNumber}
\MacroNumber{world}
Code: Select all
\expandafter\def\expandafter\csname\temp\endcsname{\csname#1\endcsname}
Code: Select all
\documentclass{article}
\usepackage{etoolbox}
\begin{document}
\newcommand*\CheckCountAssign[2]{
\ifcsdef{#1}{
\stepcounter{#2}
\def\temp{#2}
% everything works fine upto this point.
\expandafter\def\expandafter\csname\temp\endcsname{\csname#1\endcsname}
}{}
}
\def\SomeMacro#1{Hello #1!}
\newcounter{MacroNumber}
\CheckCountAssign{SomeMacro}{MacroNumber}
\MacroNumber{world}
\end{document}
George