Origin Ver.8.5.0 and Service Release 1 b161 (Select Help-->About Origin):
Operating System:Windows7HB
Hi!
I have a project like this:
and a script file containing:
[Main]
string dn$="Drug";
getn ( ) dn$ [Enter the drug name!];
run.section(,by_drug);
[by_drug]
StringArray WBookNames;
doc -ef W {
WBookNames.Add(%(page.label$));
};
WBookNames.sort();
int WBookMax = WBookNames.getSize();
run.section(,CreateNewDirs);
//run.section(,ProcessingFiles);
////------------------------------------------------------------------------------
[CreateNewDirs]
pe_cd /;
pe_mkdir "02_Ampl_ByDrug";
pe_cd "02_Ampl_ByDrug";
////------------------------------------------------------------------------------
newbook name:="Ampl_all_NaHS" sheet:=0;
newsheet name:="Raw" cols:=$(WBookMax)+1;
////------------------------------------------------------------------------------
newbook name:= "Ampl_all_%(dn$)" sheet:=0;
newsheet name:="Raw" cols:=$(WBookMax)+1;
////------------------------------------------------------------------------------
pe_cd /;
pe_mkdir "03_Min_ByDrug";
pe_cd "03_Min_ByDrug";
////------------------------------------------------------------------------------
newbook name:="Min_all_NaHS" sheet:=0;
newsheet name:="Raw" cols:=$(WBookMax)+1;
////------------------------------------------------------------------------------
newbook name:="Min_all_%(dn$)" sheet:=0;
newsheet name:="Raw" cols:=$(WBookMax)+1;
////------------------------------------------------------------------------------
pe_cd /;
pe_mkdir "04_Freq_ByDrug";
pe_cd "04_Freq_ByDrug";
////------------------------------------------------------------------------------
newbook name:="Freq_all_NaHS" sheet:=0;
newsheet name:="Raw" cols:=$(WBookMax)+1;
////------------------------------------------------------------------------------
newbook name:="Freq_all_%(dn$)" sheet:=0;
newsheet name:="Raw" cols:=$(WBookMax)+1;
pe_cd /;
pe_cd "01_Pair";
run.section(,ProcessingFiles);
////-------------------------------------------------------------------------------
[ProcessingFiles]
////
int colnum;
doc -ef W {
string WBookName$ = page.label$;
loop (ii,1,$(WBookMax)){
string bname$ = WBookNames.GetAt(ii)$;
if (WBookName$ == bname$){
colnum = $(ii)+1;
break;
};
};
page.active$ = "raw";
int ncols = wks.ncols;
loop (ii, 2, ncols){
string ColLongName$ = wcol(ii)[L]$;
string ColComment$ = wcol(ii)[c]$;
string Dirname$ = ColLongName.between("","InTime")$;
string BookName$ = ColComment.left(4)$;
if (BookName$ != "NaHS"){
BookName$ = "%(dn$)";
};
string outbookname$ = "%(Dirname$)_all_%(BookName$)";
wcol(ii)[c]$ = WBookName$;
colcopy irng:=["%(WBookName$)"]Raw!col($(ii)) orng:=["%(outbookname$)"]Raw!col($(colnum)) para:=1 data:=1 lname:=1 units:=1 comments:=1 format:=1;
wcol(ii)[c]$ = ColComment$;
};
};
After execution of this script I have:
Everything is OK, but I can't do any statistics on rows or columns in this new tables. It can be done if I rename the workbook by "hand" (renaming by pe_rename or page.label$ setup doesn't work). This is a bug or defect of my system or smth.else? Please help me to fix this problem! Thanks!