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
 options.firstmode does seem to fail
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

heckljo

Germany
2 Posts

Posted - 11/07/2017 :  12:25:22 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9.0.0
Operating System: Win 7

Hello Guys,

at first please note I am totally new to programming. Im stuck at a pretty basic function as I am trying to import csv files from our spectrometer. Frist baby steps are:

I want origin to import the file and put it in a new workbook. I therefore use the tree options... to define this.

string fn$ ="V:\Fak_WT\PERS\WT-Metalle\Projekte aktuell\RiBe_Warmfeste Al-Schrauben\Messungen\OES\2024\Ref\P1.1\2024 Ref P1.1_1.csv";
impcsv fname:=fn$ Options.FirstMode:=3;

Hence, Origin responds with "command error"
No workbooks are open yet when Im entering these lines in the command window.
adding "newbook;" at the start of my lines seems so solve the problem somehow. It leaves me with alot of questions marks why options... is irgnored/interpretated incorrectly

Thanks already for your support,

Philipp

greg

USA
1378 Posts

Posted - 11/07/2017 :  4:08:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
All X-Function parameters have default values. When you do not specify a parameter value, Origin uses the default value.
In this case, you did not specify the orng value so the function assumes the active window is a Workbook and will fail if it is not.

There is no hope!
(But I may be wrong.)
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 11/07/2017 :  4:09:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Philipp,

Becsause your path/file name contains spaces, double-quoting the file name as below in impcsv command may work:
impcsv fname:="fn$" Options.FirstMode:=3;
Could you please try?

--Hideo Fujii
OriginLab
Go to Top of Page

heckljo

Germany
2 Posts

Posted - 11/08/2017 :  11:06:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
A good morning to you Hideo,

thank you so much for your fast resposne, i appreciate it.

I thought we solved it as no command error message was given. Hence, i found out that more likely this happened due to the usage of origin on my laptop, which hast V 9.3.226 on it. Here, no command error was recieved neither using double quotes nor without them.

May this be a bug or a general issue of V 9.0.0?

Regards,

Philipp
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 11/09/2017 :  11:05:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hideo's example of adding quotes to a string variable is incorrect. When using string variable there is no issues with spaces in the file path.

The key is that the impscv function import a file to an existing book, so you must first have a workbook before you can use this x-function, like you have found out.

It is true that this x-function should report proper error when the input book does not exist.

CP
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