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
 problem with getyesno command
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

joss31

France
33 Posts

Posted - 05/28/2014 :  07:04:33 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

greg

USA
1378 Posts

Posted - 05/28/2014 :  4:56:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

joss31

France
33 Posts

Posted - 06/02/2014 :  04:14:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
{};
};



Edited by - joss31 on 06/02/2014 04:15:31 AM
Go to Top of Page

greg

USA
1378 Posts

Posted - 06/02/2014 :  4:23:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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);
Go to Top of Page

joss31

France
33 Posts

Posted - 06/03/2014 :  04:16:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.

Edited by - joss31 on 06/03/2014 04:20:23 AM
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