Graph name and subwindow of trace w/ TraceInfo

I want to change the axes of a trace based on the wave's properties, so I do:

    String graphName= WinName(0,1) 
    string traceName= stringFromList(i, traceList)
    String hAxis= StringByKey("XAXIS", TraceInfo("", traceName, 0))
    String vAxis= StringByKey("YAXIS", TraceInfo("", traceName, 0))
    GetMarquee /W=$graphName $hAxis, $vAxis // <-- error, graphName is wrong


To my knowledge there is no way to use TraceInfo to actually get the subwindow name.
ChildWindowList gives me a list of subwindows, but if I am looking for axis Bottom, all subwindows will have it (in my situation).

Anyone have a solution?

Can you please post an example of how to create a graph on which you might use this code, and also more context about how you are executing this code? For example, it's not clear how traceList is being set.

TraceInfo gives you no information about the trace's window, so I'm not sure why you bring that up.
Given the line string traceName= stringFromList(i, traceList), the list of traces must have come from some graph, so the information about the window must have been available at some time. Can you propagate the window path to your code from the place where tracelist was filled out?

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Hi John and ac,

From your replies I realized I didn't do the best job of posting an example. The function I posted is being called from the GraphMarquee menu, and prints information (average, wave indices, etc) according to the user's request. So I call the function by clicking on a graph.

While writing up a long and detailed reply, I discovered the error which had confused me: String graphName= WinName(0,1) gets the top graph's name, but TraceInfo("", traceName, 0) isn't using the top graph name --- it was using TopGraph#subgraph without my realizing.

With this I figured out the bug and have now spent enough time on the function that I hope someone else finds it useful: http://www.igorexchange.com/node/7315

j