The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 searching for worksheet name
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Qiang

UK
16 Posts

Posted - 07/24/2003 :  06:18:33 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 07/24/2003 :  6:19:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

greg

USA
1380 Posts

Posted - 08/21/2003 :  2:22:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
}
};


Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000