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
 script not working since upgrade
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

nilo

5 Posts

Posted - 04/14/2014 :  12:54:39 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Origin 9.1.0
Operating System: windows XP

Hi,

I have a script to import data and plot multiple files which is not working anymore since the Origin last upgrade (it was working on Origin 9.0). Now when I use it, the first file is imported and ploted but then it stops before importing the next one with #Command Error!. Here is the part of the script :

fname$="C:\Documents and Settings\data1.xls"; impExcel allsheets:=1 excel:=0 emptycols:=0 sname:=1 d:=YY;
string bkname$ = page.name$;
string shname$ = layer.name$;
wks.col2.type = 4;
plotxy ((2,1),(2,6),(2,11),(2,16),(2,21),(2,26),(2,31),(2,36),(2,41)) plot :=202 ogl:=[<new template:="C:\Documents and Settings\IdVd1.otp" name:="Id-Vd1">];
fname$="C:\Documents and Settings\data2.xls"; impExcel allsheets:=1 excel:=0 emptycols:=0 sname:=1 d:=YY;
string bkname$ = page.name$;
string shname$ = layer.name$;
wks.col2.type = 4;
plotxy ((2,1),(2,6),(2,11),(2,16),(2,21),(2,26),(2,31),(2,36),(2,41)) plot :=202 ogl:=[<new template:="C:\Documents and Settings\IdVd1.otp" name:="Id-Vd1">];

Could you please help me to make it work again ?

Regards,

greg

USA
1378 Posts

Posted - 04/15/2014 :  3:48:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is actually a syntax error in the script that version 9 ignored, but version 9.1 does not:
plotxy ... plot :=202 ...; // ignore ...
That space between "plot" and ":=202" is a syntax error and should not have been allowed in 9.0, but it worked anyway.

Re-write both lines as
... plot:=202 ...
and it should work.
Go to Top of Page

nilo

5 Posts

Posted - 04/17/2014 :  06:26:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you greg, but unfortunately it is not the problem. With or without the space, Origin is plotting the first graph.

The problem happens when starting the second file import, the error given is "WKS.COL2.TYPE: object property not found!"...
Go to Top of Page

greg

USA
1378 Posts

Posted - 04/17/2014 :  10:24:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Interesting...
It looks like this is due to a behavior change in the impExcel function.
The firstmode options in 9.0 are
0 = Start New Book
1 = Start New Sheets
In order to support batch processing with imported Excel data, we added "Replace Existing Data" which is found in most other import functions.

Unfortunately, the programmers (again, in their "infinite wisdom")
decided the options should be:
0 = Replace Existing Data
1 = Start New Book
2 = Start New Sheets
Since the default is 0 in both cases, the behavior changed.

Edit the second instance of impExcel as follows:
impExcel firstmode:=1 allsheets:=1 excel:=0 emptycols:=0 sname:=1 d:=YY;
Go to Top of Page

nilo

5 Posts

Posted - 04/22/2014 :  10:41:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It works ! Thank you Greg !

I did not think about it, you saved my time.
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