T O P I C R E V I E W |
joss31 |
Posted - 05/28/2014 : 07:04:33 AM Hello everybody,
I try the command "getyesno" when I test it with little programme it works as well (in green). type -a; getyesno (Do you want to take trend & microcut?) nvalue (selection_1); nvalue=;
if (nvalue == 1) {} else { getyesno(Do you want to take microcut?) nvalue1 (selection_2); if(nvalue1 == 1) {} else {}; };
But when I use it with my programme, origin stop to work I think it's because my script is very long or something like that, but I'm not sure. type -a; getyesno (Do you want to take trend & microcut?) nvalue (selection_1); nvalue=;
if (nvalue == 1) {getfile -m *.*; // Prompt for multiple files for (ii = 1; ii <= count; ii ++) { getfile -g ii; // Get the iith file into %A open -w %A; // This IMPORTS that file hfile=file.open(%A); %P = HEAP%[%A, 50:53]%[%A, 74:76]; %K = HEAP%[%A, 50:53]; %V =%[%A, 74:76]; worksheet -c ALLSTRTIME; worksheet -c ECH%V; worksheet -t 3 4; %A = %[%Z,@2];
%B = %[%A,>' '];
ttHours = %[%B,1:2]; ttMinutes = %[%B,4:5]; ttSeconds = %[%B,7:%[%B]]; Triggertime = (ttHours /24) *86400 + (ttMinutes /1440)*86400 + ttSeconds; if (ii <= (count-(count-1))) { TTIME0 = Triggertime; TTIME1 = 0; TTIME2 = 0; col(3)=%(%H,1)+TTIME2; col(4)=col(2); win -r %H %P; %M = %H; win -t plot line; %X = %H; win -t plot line; %O = %H; graph=0; val=1; color=1; } else { TTIME0 = TTIME0; TTIME1 = Triggertime; if ($(TTIME0) != $(TTIME1)) { TTIME2 = TTIME1-TTIME0; TTIME0 = TTIME0; col(3)=%(%H,1)+TTIME2; col(4)=col(2); win -r %H %P; %M = %H; %Q = %H; } col(3)=%(%H,1)+TTIME2; col(4)=col(2); win -r %H %P; %M = %H; %Q = %H; }; win -a %X; layer.plotxy(%M_ALLSTRTIME,%M_ECH%V); layer -a; set %M_ECH%V -c $(ii); if (ii >(count-(count-1))) { if (graph < 4){ win -a %O; layer.plotxy(%Q_Starttime,%Q_ECH%V); layer -a; set %Q_ECH%V -c $(color); color=color+1; graph=graph+1; } else { win -a %O; label -xb Time(sec); label -yl Voltage(V); legend -p; win -t plot line; %O = %H; layer.plotxy(%Q_Starttime,%Q_ECH%V); layer -a; color=1; set %Q_ECH%V -c $(color); val=val+1; graph=1; color=color+1; }; }; if (ii < count) { window -t data; }; }; win -a %X; label -xb Time(sec); label -yl Voltage(V); legend -p;
val=val+1; win -a %O; label -xb Time(sec); label -yl Voltage(V); legend -p;
window -t data; getfile -m *.*; getfile -g 1; open -w %A; worksheet -c vib; worksheet -t 3 4; col(3)=(col(2)-1)*0.20; %M = %H; win -a %X; layer.plotxy(%M_Starttime,%M_vib); layer -a; set %M_vib -c 20; legend -p;}
else { getyesno(Do you want to take microcut?) nvalue1 (selection_2); if(nvalue == 1) {} else {};
};
So can you help me please!
Thank you in advance. |
4 L A T E S T R E P L I E S (Newest First) |
joss31 |
Posted - 06/03/2014 : 04:16:19 AM For example i name my OGS file "take_trend_microcuts.ogs" but I don't understand the difference between this two commands
ed.open(take_trend_microcuts.ogs); run.section( , take_trend_microcuts);
And when i use the run.section (for this moment), I have succeed to make it work. |
greg |
Posted - 06/02/2014 : 4:23:49 PM It looks like you already figured out how to use run.section within a file. When calling from outside the file, specify the name and section:
run.section(filename,sectionname); // Do not need .OGS of filename
If the file is in your Origin folder, you don't need a path and you script would look like:
run.section(somename,main); |
joss31 |
Posted - 06/02/2014 : 04:14:39 AM I save my code in an OGS file but I don't understand how I call them I need to do that?
[main] getyesno (Do you want to take trend & microcut?) nvalue (selection_1); if (nvalue == 1) { run.section( , take_trend_microcuts); }
[take_trend_microcuts] getfile -m *.*; // Prompt for multiple files for (ii = 1; ii <= count; ii ++) { getfile -g ii; // Get the iith file into %A open -w %A; // This IMPORTS that file[.....] else {}; };
|
greg |
Posted - 05/28/2014 : 4:56:29 PM Your script may very well be too long. Time to start putting all this code in an OGS file and breaking it up into sections. http://www.originlab.com/doc/LabTalk/guide/From-Files |
|
|