|T O P I C R E V I E W
||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)
||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.
||Posted - 09/24/2021 : 05:57:31 AM
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;
Originlab Technical Service Team