The Origin Forum
File Exchange
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
 Origin Forum
 LabTalk: newbook not working
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Iveta_

United Kingdom
6 Posts

Posted - 09/24/2021 :  05:09:10 AM  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 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?

Shirley_GZ

China
Posts

Posted - 09/24/2021 :  05:57:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Iveta_

United Kingdom
6 Posts

Posted - 09/24/2021 :  06:10:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
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