Renamewindow or DoWindow/C with variables?

Hi all.

As I wrote that simple sentence, I just figured out a way to get around my problem, but I'm going to ask it anyway.

Say I had something like this.

String windowNName="AboutWindow"
...
Display/N="GenericName" Y vs. X
...
Renamewindow GenericName windowNName
//or
DoWindow/C windowNName //Since the window I'm renaming is the top most window, always.)


(Fill in the blanks and please ignore any syntax errors I may have put in there.)

When I do something like that (in a much more complicated program.) the window gets renamed to "windowNName." How would I make renamewindow or DoWindow use the value of the string instead of the name of the string itself?

EDIT: The following does not work. I have the same problem with the Display command.
To get around it I think I can simply name the window when I display it, but I'd like to know the answer anyway for future reference.

Thanks.
Sigh: You simply put a dollar sign in front of the variable name. I didn't find that anywhere in the command help browser on any of those commands.

Display/N=$windowNName Y vs. X
You should use any operation in preference to DoWindow. DoWindow is ancient, difficult to use reliably, and it does too many different things. RenameWindow also allows you to rename subwindows, too.

You may be interested to know that operations that create windows (like Display) set a string variable S_name. So you could do something like
String windowNName="AboutWindow"
Display Y vs X
RenameWindow $S_name, $windowNName

If there is other code between Display and RenameWindow, be sure to stash the contents of S_name in your own string variable; another operation could possibly change it.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
johnweeks wrote:
You should use any operation in preference to DoWindow. DoWindow is ancient, difficult to use reliably, and it does too many different things. RenameWindow also allows you to rename subwindows, too.

You may be interested to know that operations that create windows (like Display) set a string variable S_name. So you could do something like
String windowNName="AboutWindow"
Display Y vs X
RenameWindow $S_name, $windowNName

If there is other code between Display and RenameWindow, be sure to stash the contents of S_name in your own string variable; another operation could possibly change it.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com


The few of you who reply to the majority of threads on this site are absolute geniuses. That $S_name tip will be extremely useful in the future. Thank you so much.