Origin Version (Select Help-->About Origin): Operating System:Windows XP
I was wondering if anyone could tell me where I might learn how to write macros in LabTalk in order to use them in Origin. I have looked at a few resources but I am not sure how to start. I have programming experience, but I just don't understand how to go about structuring a script for a macro and what to put with the script (button picture, etc) in order to make it work. On top of that, I'd like to be able to find a resource that might already have examples of things/ operations that I might want to do in my macros. I appreciate your time.
More infomaiton and examples are available in the help file: LabTalk.chm. Typically, it locates in the subfolder \Help in the folder where your Origin program is installed.
You can see the list of Origin pre-defined macros by opening the script window and typing list -m<Enter> You can list any of these pre-defined macros by using its name as follows (shown for ARRANGELAYERS macro) : def ARRANGELAYERS<Enter> which will output the full script : {
x = 100 - Left - Right - (%2-1)*xGap; x/=%2; y = 100 - Top - Bottom - (%1-1)*yGap; y/=%1; if(x < 5 || y < 5) { ty -b $General.SmallLayer; break 1; }; k = 0; for(i = 1; i <= %1; i+=1) { for(j = 1; j <= %2; j+=1) { for(k+=1;k <=page.nlayers;k+=1) { #!k=; layer -s k; if(layer.link == 0 || layer.unit != 7) break; }; layer -u 1; if(%2==1) { layer x y [Left+(j-1)*(x + xGap)] [Top+(%1 - i)*(y + yGap)]; } else { layer x y [Left+(j-1)*(x + xGap)] [Top+(i-1)*(y + yGap)]; }; } };
}
Note that %1, %2 etc. are the placeholders for the arguments passed to the macro. You can have up to 5 arguments.