Renamewindow or DoWindow/C with variables?
reepingk
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.)
...
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.
January 13, 2015 at 09:55 am - Permalink
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
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
January 14, 2015 at 10:33 am - Permalink
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.
January 16, 2015 at 07:26 am - Permalink