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
 RE: Origin Macros
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jprank2

USA
Posts

Posted - 06/28/2006 :  4:40:16 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

Deanna

China
Posts

Posted - 07/02/2006 :  9:57:15 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
To define a macro, just use

define macroName;



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.

I hope it will be able to help.

Deanna
OriginLab GZ Office
Go to Top of Page

greg

USA
1380 Posts

Posted - 07/05/2006 :  2:19:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.

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