T O P I C R E V I E W |
nilo |
Posted - 04/14/2014 : 12:54:39 PM 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,
|
4 L A T E S T R E P L I E S (Newest First) |
nilo |
Posted - 04/22/2014 : 10:41:15 AM It works ! Thank you Greg !
I did not think about it, you saved my time. |
greg |
Posted - 04/17/2014 : 10:24:38 AM 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; |
nilo |
Posted - 04/17/2014 : 06:26:06 AM 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!"...
|
greg |
Posted - 04/15/2014 : 3:48:50 PM 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. |
|
|