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
 Origin Forum
 Worksheet Scripts
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

watec

Switzerland
4 Posts

Posted - 03/13/2002 :  10:50:33 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Why in a worksheet scripts brackets have to be like this ?:
if (py>0) {
ry=dy/py+0.05;
}
else {
ry=dy+0.05;
}
In all other scripts the more debug friendly version:
if (py>0)
{
ry=dy/py+0.05;
}
else
{
ry=dy+0.05;
}
works fine.

rtoomey

USA
184 Posts

Posted - 03/13/2002 :  11:57:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Could you tell me which version you tried this in? I tried it in Origin 6.1 SR4 (v.6.113) and experienced the problem in a slightly different manner. If I enter something like:

if (condition) {
// when condition is met (i.e. true), execute any script in here
}
else {
// when condition is not met, execute any script in here
}


the script would work when the condition was met, but wouldn't when it wasn't. However, if I entered:

if (condition) {
// when condition is met (i.e. true), execute any script in here
}
else
{
// when condition is not met, execute any script in here
}


the script would execute fine for both a true or false result. What this suggested is the placement of brackets for the if didn't matter, while the placement of the brackets in the else did.

Also, it would be helpful if you described the context of your situation and the steps you took which led to the problem. For instance, are you referring to the dialog obtained when selecting Tools : Worksheet Script? Or is it a different dialog? It would be great if you could clarify this.

- rtoomey

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 03/13/2002 :  12:37:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The problem will exist in the Worksheet Script dialog, which is a dialog that we recommand not putting actual codes into. This dialog employed a simplified interface to allow script writing that does not require a terminating ';', similar to an CNF file. If you want real LabTalk, you should put that script into a OGS file and in that worksheet script dialog, put a single line

run.section(myScriptFile,MySection)

In CNF files and in worksheet script dialog, this simplified interface assumes all script to be single line, and thus the there is no need for terminating ';', then the interpreter will need the open '{' to know that your script is multi-lined.


CP




Go to Top of Page

watec

Switzerland
4 Posts

Posted - 03/14/2002 :  05:23:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks
Yes, I used the dialog obtained when selecting Tools : Worksheet Script.
Now I know, that this dialog employs a simplified interface.
So I think in this case it is better to stay with OGS files.
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