When duplicating graph windows in Origin, the new duplicate window remains the active window. When duplicating worksheet windows in Origin the original worksheet becomes the active window again after duplication.Are you trying to get the name of a duplicate worksheet? In this instance, since the original window becomes the active window immediately after window duplication, the following script shows how to get the name of the new duplicate window by minimizing the original worksheet window.
win -d; //window duplicate
win -i; //minimize active window
%N=%H; //pass the active window name (%H) to a free string variable