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
 All Forums
 Origin Forum
 Origin Forum
 Differences in running scripts in Window vs Menu

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
a_user Posted - 08/14/1998 : 1:16:00 PM
Hi there !
I have some pretty strange things going on here.
I have written a script (included below) that is supposed to do some things with plot etc. When I run it from the script window (which is how I wrote it) it runs fine, but when I call it from a menu (with run All-PIE-Curves.txt) it does not completely do the same thing.
Has anybody had the same experience ?

Short explanantion of what the script does.
The Project consists out of 6 worksheets (Scan3, Scan4, Scan5, Scan 1B, Scan2B and Scan3B).
They all contain similar data of different measurements. In order to compare these measurements we want to plot the corresponding data sets of all measurements on one page. The script goes over all worksheets, picks out matching columns (have the same number in each worksheet). These are plotted on 6 temporary plots (using a certain template). These are merged into one plot and the 6 different layers are arranged in 2 rows of 3 plots. These 6 graphs all contain one column of a certain worksheet. This all runs fine when I run it from the script window.

But when I call it from the menu.
============Menu
menu -Worksheet
menu 11 &PMacro
menu
(PIE &Curves for all masses from all scans)
{
run
All-PIE-Curves.txt
}
====================================
It is only partially run.It only keeps the last merged plot (although it goes through all steps in the routine). The graphs in this page (6 layers) contain ALL columns of the worksheet !!! I really don't understand what is guing on.
Can anybody help me, plz.
Thanks,
Peter

P.S. Feel free to use and alter this macro for your own use.
======================Script:All-PIE-Curves.TXT========================================================================================================================================================
type -n Making PIE Curve comparissons for all masses throughout all Scans. \n
Are all Scan data files present and named: \n Scan3 Scan4 Scan5 Scan1B Scan2B
Scan3B;
win -a Scan3;
getnumber -s (Number of Cluster sizes to plot) totplots (Plot Info);
loop (s,1,3)
{
win -a Scan$(s 2);
loop (var,2,wks.ncols)
{
wks.col$(var).type=2;
};
win -a Scan$(s)B;
loop (var,2,wks.ncols)
{
wks.col$(var).type=2;
};
};
loop (colvar,2,totplots 1)
{
win -a Scan3;
wks.col$(colvar).type=1;
worksheet -s 0 0 0 0;
worksheet -p 201 CLUSTER-PIE.OTP;
worksheet -b 
wks.col$(colvar).type=2;
worksheet -s 1 1 1 1;
win -a Scan4;
wks.col$(colvar).type=1;
worksheet -s 0 0 0 0;
worksheet -p 201 CLUSTER-PIE.OTP;
worksheet -b 
wks.col$(colvar).type=2;
worksheet -s 1 1 1 1;
win -a Scan5;
wks.col$(colvar).type=1;
worksheet -s 0 0 0 0;
worksheet -p 201 CLUSTER-PIE.OTP;
worksheet -b 
wks.col$(colvar).type=2;
worksheet -s 1 1 1 1;
win -a Scan1B;
wks.col$(colvar).type=1;
worksheet -s 0 0 0 0;
worksheet -p 201 CLUSTER-PIE.OTP;
worksheet -b 
wks.col$(colvar).type=2;
worksheet -s 1 1 1 1;
win -a Scan2B;
wks.col$(colvar).type=1;
worksheet -s 0 0 0 0;
worksheet -p 201 CLUSTER-PIE.OTP;
worksheet -b 
wks.col$(colvar).type=2;
worksheet -s 1 1 1 1;
win -a Scan3B;
wks.col$(colvar).type=1;
worksheet -s 0 0 0 0;
worksheet -p 201 CLUSTER-PIE.OTP;
worksheet -b 
wks.col$(colvar).type=2;
worksheet -s 1 1 1 1;
win -m;
win -r Graph7 Mass$(colvar);
loop (var,1,6)
{
win -b Graph;
win -c;
};
win -a Mass$(colvar);
loop (nlayer,1,6){
layer$(nlayer).unit=4;
layer$(nlayer).height=70;
layer$(nlayer).width=62;
};
loop (nlayer,1,3){
layer$(nlayer).top=20;
layer$(nlayer 3).top=99;
};
layer1.left=43;
layer2.left=120;
layer3.left=196;
layer4.left=43;
layer5.left=120;
layer6.left=196;
win -a Mass$(colvar);
win -i };
win -a Scan3;
win -i;
win -a Scan4;
win -i;
win -a Scan5;
win -i;
win -a Scan1B;
win -i;
win -a Scan2B;
win -i;
win -a Scan3B;
win -i;
loop
(colvar,2,totplots 1){
win -a
Mass$(colvar);
};

[Note: This message was edited by Julie]

3   L A T E S T    R E P L I E S    (Newest First)
a_user Posted - 08/14/1998 : 1:38:00 PM
Using RUN.SECTION()

By formatting your files like our OGS files, you can write short scripts that can take arguments (up to 5) and return (integer) values. The run.section() command does not have the line-by-line limitation of the run command.
Origin uses over 150KBytes of LabTalk script in various OGS files in the Origin directory.
To see where we use these OGS scripts, open the Script window, hold down the Ctrl key (in 5.0 you must hold down Ctrl-Shift) and select an Origin menu item (like ANALYSIS:FFT) and - if the menu item runs a script - the script command string(s) appear in the Script window.

Tip : Remember to keep scripts to less than about 1000 characters.

a_user Posted - 08/14/1998 : 1:36:00 PM
There is always a reason...

The problem was that the RUN command that it executes the script line-by-line.
When using multiple line commands you should use the line continuation
character '\'.
This help came from the Technical support engineers at Microcal.

They also suggested to use the run.section(filename,sectionname) which is a
better method since it allows you to pass arguments and return values too. See
the OGS files for examples.
I don't know whether this command also works line-by-line - I'll ask. If
anybody has experience with this method, plz contact me. I want to know how
you can make use of those arguments.

Peter

a_user Posted - 08/14/1998 : 1:18:00 PM
... strange things

Hello Peter,

This won't help you in any way, but I had the same problems. I normally run scripts as worksheet scripts or buttons . You could try these options (.. in order to produce other bugs ). It definitively is strange. Often only (set or unset) carriage returns or spaces are sufficient to make a script fail (see my posting .. and other peculiarities). And you get different bugs when you run scripts with V 4.0 and V 4.1....


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000