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 sequence when using doc -e
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Yongbin

China
3 Posts

Posted - 11/11/2016 :  1:05:42 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System: Windows 7
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:
windows 7

Hi all,

When using doc -e W to loop all the workbooks, what is the looping sequence? Is there any way to modify this? Seems that it follows the workbooks' creation time but sometimes they are different.

For example, I have
A
B
C
D
four workbooks. When I use doc -e, sometimes it goes like A B C D, sometimes A C D B. The sequence really matters to me and I'm wondering if there is any way I can make sure it follows A B C D.

Any help would be appreciated.

yuki_wu

896 Posts

Posted - 11/13/2016 :  10:17:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The looping sequence follows the z-order.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632599%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396#zorder

If you want to loop the workbooks form A to D in turn, you should active the workbook windows like A-B-C-D, and then save the project. You can find that the loop will go like A-B-C-D as you pleased.

Regards,
Yuki
OriginLab

Edited by - yuki_wu on 11/14/2016 05:15:30 AM
Go to Top of Page

aplotnikov

Germany
162 Posts

Posted - 11/14/2016 :  09:18:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

you can also use loop over the string array containing workbook names instead.


StringArray saWBNames;
doc -e W {saWBNames.Add(%H)}

saWBNames.Sort();

loop(ii,1,saWBNames.GetSize()) {
  win -a %(saWBNames.GetAt(ii)$);
  ...
}


Regards,

Alexei
Go to Top of Page

Yongbin

China
3 Posts

Posted - 11/14/2016 :  5:56:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ah, I see. Finally figured it out. Thanks, Yuki!

The way Alexei suggested is even better. Thanks a lot.
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