| T O P I C R E V I E W |
| Qiang |
Posted - 07/24/2003 : 06:18:33 AM Hi all,
I'm trying to write an if statement in an OGS file.
I have 2 worksheets open when I execute this command. One called "WinName" the other called "WinName-info". Where the string WinName is specified by the user. the only difference is the ending where one worksheet has the string -info attatched to the end. When the if statement is run, the user has already chosen columns in the WinName worksheet so that is the active worksheet.
To keep the program general, I'd like to loop through all the worksheet names that is open when the if statement is run. WinName can not be passed into the if statement. I'd like to go through all the worksheet names and search for any worksheetname that ends in "-info"( this can be changed if necessary). And if so the if statement does something and else does something else.
Is it possible?
thanks
Qiang
|
| 2 L A T E S T R E P L I E S (Newest First) |
| greg |
Posted - 08/21/2003 : 2:22:31 PM You can use this to find those worksheet windows that end in "info":
doc -e W { if("%[%H,$(%[%H]-3):%[%H]]" == "Info") { type %H MATCH FOUND; // Put your INFO code here } else { type %H doesn't match "Info"; // Put you NOT INFO code here } };
Since Origin doesn't support '-' in a window name, maybe what you are seeing is a window name plus a label which appears as: WindowName - WindowLabel
Here is a modification that searches for worksheets where the window Label is "info":
doc -e W { %A = page.label$; if("%A" == "Info") { type %H MATCH FOUND; // Put your INFO code here } else { type %H doesn't match "Info"; // Put you NOT INFO code here } };
|
| Mike Buess |
Posted - 07/24/2003 : 6:19:56 PM Hi Qiang,
I'm not sure I understand completely what you want to do, but I think the "doc -e W { script }" command is what you want. It loops through all existing worksheets and applies the bracketed script to each. For example...
doc -e W { ty %H; };
...that types the name of each existing worksheet. (%H holds the wks name in each iteration.)
Mike Buess Origin WebRing Member |