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
 Origin Forum
 LabTalk: newbook not working

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
Iveta_ Posted - 09/24/2021 : 05:09:10 AM
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System: Windows 10

Hi, what would the reason be for the command

newbook name:=bk$ option:=lsname

not to work (but the rest of the script to execute uninterrupted)..
bk$ is a string holding the name of the new workbook.

I am trying to automate a very long tedious processing + plotting procedure, I am calling the .ogs file and passing 5 variables into it, from the Command window.
Sometimes the new workbook is created (and activated) successfully and everything goes as it should, but sometimes - no new workbook is created and it tries to use the current active book to do the processing on it instead, which is of course a mess. I tried many things and it seems to be rather random as well, and it does seem to throw any errors.

I included a 2s pause before and after newbook command, in case it has to do with some lag between running the script and the actual command execution.

I have 'type' statements everywhere trying to figure out what's going on but not much help - it just shows as I expect, sometimes the new book is formed, sometimes it is not and the existing workbook remains the "active" one instead.

No error is given at all in the process. If I manually create a blank workbook and set this as the active one prior to running the script, it executes everything as it should (it seems). But the whole point is that I don't want to be creating everything manually ..

What reasons could there be? Any other ideas how I can troubleshoot/debug this?
2   L A T E S T    R E P L I E S    (Newest First)
Iveta_ Posted - 09/24/2021 : 06:10:36 AM
This seems to work, thanks for the quick response! I didn't realise it is looking for matching names in the entire project file, not just the folder itself.
Shirley_GZ Posted - 09/24/2021 : 05:57:31 AM
Hi Iveta,

Maybe you need add one more variable "chkname" to check whether the name has already existed, such as

newbook name:=bk$ option:=lsname chkname:=0;

https://www.originlab.com/doc/X-Function/ref/newbook

Thanks,
Shirley
OriginLab

Originlab Technical Service Team

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