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 sequence when using doc -e

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
Yongbin Posted - 11/11/2016 : 1:05:42 PM
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.
3   L A T E S T    R E P L I E S    (Newest First)
Yongbin Posted - 11/14/2016 : 5:56:18 PM
Ah, I see. Finally figured it out. Thanks, Yuki!

The way Alexei suggested is even better. Thanks a lot.
aplotnikov Posted - 11/14/2016 : 09:18:46 AM
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
yuki_wu Posted - 11/13/2016 : 10:17:06 PM
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

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