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
 Batch Processes in Origin 5.0
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

whysker

Germany
1 Posts

Posted - 11/23/2001 :  6:21:13 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am using Origin 5.0 and want to program a simple batch process in the script language to avoid loeading, converting and saving 500 files ...
So I wrote the following short script:

worksheet -e ASCII;
getfile -m *.cv;
p=1;
for( ;pgetfile -g p;
open -w %A;
worksheet -s A 0 B 0;
worksheet -p 200 Graph1;
save -bs Graph1 %A 400 300 [B];
window -c Graph1;
p++;
};

What it should do is ... loeading the file into the worksheet - generating the according graph of the selected columns - save a bmp-File of this graph to the same directory - close the graph - load the next file .... and so on!

Apparently I get the two following error messages that are messing up the whole thing:

Executing the line: open -w %A;
the following error message pops up: Error:draw -n header -r

Executing the line: save -bs Graph1 %A 400 300 [B];
the following error message pops up: Error:save -bs Graph1 %A 400 300 [B]

Then the for loop also stops ... the window doesn't close etc.

Does anyone know what I am doing wrong?! How do you program such a simple batch process (load, save) ... with a bitmap output (or .wmf-File).

Any hint is welcome.

Thonks,

Tom.

rtoomey

USA
184 Posts

Posted - 11/26/2001 :  2:29:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The script you supplied has a few problems. Below is a description of each.

  1. The for loop is not quite right. The easiest thing to do would be to utilize the "count" variable which gets set in the getfile -m command.

  2. You try to use the worksheet -s command option with column names. This command accepts only numbers. To get the column number associated with a particular column name, use the colnum() function. To express the value of the colnum() function in a command, enclose it in $().

  3. The save -bs command has the [B] option in it. This option should be entered as simply B, not [B]. The square brackets are used in our documentation to indicate that the setting is optional. They aren't actually part of the command.

  4. The save -bs command creates a command error no matter what you do. This is a bug which was addressed in Origin 6.1. To avoid this bug in earlier versions, place the save -bs command in a separate section in an OGS file.
I have modified your script to take all these things into account. Copy the script below from // begin script to // end script and save it as "Script.OGS" in your Origin 5.0 installation folder.


// begin script

[main]

worksheet -e ASCII;
getfile -m *.cv;
for(ii=1;ii<=count;ii++)
{
getfile -g ii;
open -w %A;
%B=%H;
worksheet -s $(colnum(B)) 0 $(column(B)) 0;
worksheet -p 200;
run.section(,savebmp);
window -c %H;
win -a %B;
}

[savebmp]

save -bs %H file$(ii).bmp 400 300 B;

// end script



Then, in the script window, execute the following:

run.section(script,main);

Note: The name "script" can be replaced if you prefer. Just make sure you replace it in both places (i.e. in the run.section and when saving the file to your Origin 5.0 insatllation folder).

If this does not work, please let me know.

-rtoomey




Go to Top of Page

rtoomey

USA
184 Posts

Posted - 11/27/2001 :  10:51:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I also wanted to mention that there's a Tech Review directly related to this type of scripting. It is called Batch Processing Files in Origin. It is located at:

http://www.originlab.com/www/resources/tech_reviews/june2000/page1.asp

- rtoomey

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