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
 Looping over selected Wbk, Wks, Col
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AKazak

Russia
1205 Posts

Posted - 05/02/2020 :  09:17:01 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2019b (64-bit) 9.6.5.169
Windows 7 Pro x64 SP1

Greetings!

What would be a general approach to loop over workbooks, worksheets, columns, cells selected via GUI?
https://www.originlab.com/doc/LabTalk/ref/Document-cmd doesn't contain the answer.

Thank you.

cpyang

USA
1406 Posts

Posted - 05/02/2020 :  1:54:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
doc -e is mainly to loop over books and sheets, or graphs and layers.

Maybe you can give a story on what do you need to do?

CP
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 05/02/2020 :  7:05:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

doc -e is mainly to loop over books and sheets, or graphs and layers.

Maybe you can give a story on what do you need to do?

CP




I what to manipulate with columns only of the selected worksheets in the active workbook.

One of the possible ways to do this is
doc -e LW

and check whether the sheet is selected.

Is there a kind of IsSelected boolean property of a worksheet?
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 05/02/2020 :  8:08:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Yes, better then Boolean in fact, use

[Main]
	if(wks.Sel & 16) 
		type "column selected";
	else
		type "no column selection";


See
https://www.originlab.com/doc/LabTalk/ref/Wks-obj

CP

Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 05/03/2020 :  05:50:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

Yes, better then Boolean in fact, use

[Main]
	if(wks.Sel & 16) 
		type "column selected";
	else
		type "no column selection";


See
https://www.originlab.com/doc/LabTalk/ref/Wks-obj

CP



wks.Sel indicates the fact of selection, but don't show what exactly is being selected.
How do I get a reference to the selected range of cells, columns row labels?
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 05/03/2020 :  09:41:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
wks.Sel;
sel$=;

Regards,

Nikolay
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 05/03/2020 :  10:19:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I am afraid you will need to use OriginC for such detailed access.


void wsel()
{
	Worksheet wks = Project.ActiveLayer();
	if(!wks)
		return;
	int	c1, c2, r1, r2;
	int	nSel = 	wks.GetSelectedRange(r1, c1, r2, c2);
	if(nSel & WKS_SEL_LABEL)
		printf("Label Row selected, c1 = %d, r1=%d, r2=%d\n", c1, r1, r2);
	else if(nSel & WKS_SEL_RANGE)
		printf("Data cells selected, r1=%d, c1=%d\n", r1, c2);
}




CP
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 05/04/2020 :  05:43:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Oops.Sorry for confusing. Of course I meant:
get_wks_sel; sel$=;

Nikolay
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 05/04/2020 :  06:57:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Great --- thank you!

What are the X- or OC-functions that return a list of selected workbooks (in object manager) and sheets (in the active workbook)?
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 05/05/2020 :  09:17:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by AKazak

Great --- thank you!

What are the X- or OC-functions that return a list of selected workbooks (in object manager) and sheets (in the active workbook)?



What I want is to select several worksheets in GUI and process the worksheet one-by-one with a script.
Any ideas?
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 05/05/2020 :  09:46:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
Look at GetNumber option :@BB<browser> Sheet / Sheets
Might be that help.

Nikolay
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 05/05/2020 :  11:05:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by nick_n

Hi,
Look at GetNumber option :@BB<browser> Sheet / Sheets
Might be that help.

Nikolay



Looked at https://www.originlab.com/doc/LabTalk/ref/GetNumber-cmd, but it seems to be a dialog with the Browse button.
Do you mean selecting target sheets in a special dialog before processing the data?
Go to Top of Page

nick_n

Finland
125 Posts

Posted - 05/05/2020 :  12:46:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,
Yes. Also you can try OC:
PageBase::GetStatus
I've never used that before, so no comments right now. May be somebody from support can help you. Udachi,


Nikolay
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