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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Looping over selected Wbk, Wks, Col

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
AKazak Posted - 05/02/2020 : 09:17:01 AM
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.
12   L A T E S T    R E P L I E S    (Newest First)
nick_n Posted - 05/05/2020 : 12:46:53 PM
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
AKazak Posted - 05/05/2020 : 11:05:17 AM
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?
nick_n Posted - 05/05/2020 : 09:46:08 AM
Hi,
Look at GetNumber option :@BB<browser> Sheet / Sheets
Might be that help.

Nikolay
AKazak Posted - 05/05/2020 : 09:17:20 AM
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?
AKazak Posted - 05/04/2020 : 06:57:45 AM
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)?
nick_n Posted - 05/04/2020 : 05:43:03 AM
Oops.Sorry for confusing. Of course I meant:
get_wks_sel; sel$=;

Nikolay
cpyang Posted - 05/03/2020 : 10:19:16 AM
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
nick_n Posted - 05/03/2020 : 09:41:39 AM
Hi,
wks.Sel;
sel$=;

Regards,

Nikolay
AKazak Posted - 05/03/2020 : 05:50:26 AM
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?
cpyang Posted - 05/02/2020 : 8:08:56 PM
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

AKazak Posted - 05/02/2020 : 7:05:03 PM
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?
cpyang Posted - 05/02/2020 : 1:54:29 PM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000