The script you supplied has a few problems. Below is a description of each.
- 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.
- 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 $().
- 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.
- 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