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
 run .ogs files containing the command for
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Aure

UK
Posts

Posted - 08/11/2004 :  12:37:02 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Original question:

Typing the following commands in the script window:
for (ii = 1; ii <= 4;ii ++)
{
type "ii = $(ii)";
};
and highlighting all lines and clicking enter produces the output:
ii = 1
ii = 2
ii = 3
ii = 4

But placing the same commands in a file called test.ogs and issuing the command:
run test.ogs
produces the following (different) output:
ii=5

Answer:--------------------

Hi,

Use the command:
run.section(test.ogs)
instead.

If you then place the code under a section in the OGS file, such as:

[mysection]
for (ii = 1; ii <= 4;ii ++)
{
type "ii = $(ii)";
};
[someothersection]



then you can use the command
run.section(test.ogs,mysection)

Easwar
OriginLab

P.S. I altered the text of your original post by mistake. My apologies.

Hideo Fujii

USA
1582 Posts

Posted - 08/11/2004 :  4:52:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

In the "Run" command section in LabTalk Help, there is a description:
  ...The run command executes on a line-by-line basis.
Multi-line structures must include the line continuation character "{" ...

So, in your case, merging "{" in the the second with the
first line will solve the problem. That is:
  for (ii = 1; ii <= 4;ii ++) {
  type "ii = $(ii)";
  };
From the Script window, you forced to execute all lines
by highlighting.

Hideo
OriginLab



Edited by - Hideo Fujii on 08/11/2004 4:56:12 PM

Edited by - Hideo Fujii on 08/11/2004 4:57:21 PM
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