generating window recreation macros from within a user-defined function
kbrowne
Here's what I've got so far to try to illustrate my idea, but this code just isn't cutting it:
Function Hide()
String list = WinList("*",";","WIN:1")
Variable numItems = ItemsInList(list), i
for (i = 0; i<numItems; i+=1)
String plot
plot = StringFromList(i,list)
String plotmacro
plotmacro = WinRecreation(plot,0)
print plotmacro // for de-bugging purposes. It successfully prints the recreation macro for each graph
execute "MyMacro(plotmacro)"
endfor
End
Macro MyMacro(input)
String input
print input
End
String list = WinList("*",";","WIN:1")
Variable numItems = ItemsInList(list), i
for (i = 0; i<numItems; i+=1)
String plot
plot = StringFromList(i,list)
String plotmacro
plotmacro = WinRecreation(plot,0)
print plotmacro // for de-bugging purposes. It successfully prints the recreation macro for each graph
execute "MyMacro(plotmacro)"
endfor
End
Macro MyMacro(input)
String input
print input
End
When I run Hide(), MyMacro throws an error, saying that it expected a string expression. What I want is to somehow get the content in the plotmacro string into MyMacro, so that this macro creates the window recreation macro for every graph that is passed to it.
Any help would be greatly appreciated. Thanks very much.
Kevin
DoWindow/R
and especially the explanation for executing it in a running function.November 3, 2014 at 02:27 am - Permalink
What I want to be able to do is to generate all of these window recreation macros, but that could conceivably be done after the function has stopped running, correct? How might that be done?
November 3, 2014 at 10:24 am - Permalink
String list = WinList("*",";","WIN:1")
Variable numItems = ItemsInList(list), i
for (i = 0; i<numItems; i+=1)
String plot
String cmd
String cmdKill
plot = StringFromList(i,list)
String plotmacro
plotmacro = WinRecreation(plot,0)
print plotmacro // for de-bugging purposes.
sprintf cmd, "DoWindow/R %s", plot
sprintf cmdKill, "DoWindow/K %s", plot
Execute/P cmd
Execute/P cmdKill
endfor
End
November 3, 2014 at 12:47 pm - Permalink
Execute/P
as in jtigor's example.November 3, 2014 at 01:40 pm - Permalink
November 3, 2014 at 03:27 pm - Permalink
Kevin
November 3, 2014 at 04:08 pm - Permalink