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
 Origin Forum
 Menu/toolbar command script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

amyz

Canada
Posts

Posted - 05/26/2005 :  2:05:47 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
[Origin 7.0 installed in Windows XP]

I'm having some trouble piecing together parts of the sample scripts provided in order to create my own program. The algorithm I have in mind is simple, and I've done it just by point-and-click method with the menubar and toolbar. I'd like to write a program to eliminate the manual tediousness of some steps...wondering if Origin has the capability to display the script/code/syntax for the corresponding command I input via the toolbar or menu. Ideally then, each of my steps would be converted into one program, and automated when I input an ascii data file.

Thanks

Mike Buess

USA
3037 Posts

Posted - 05/26/2005 :  2:29:13 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You should find what you need here...

http://www.nmrtools.com/labtalk/i_menu.html

Mike Buess
Origin WebRing Member
Go to Top of Page

Leo_Li

China
Posts

Posted - 05/26/2005 :  9:44:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
or just press "Ctrl+Shift" when clicking a toolbar button or menuitem.
Go to Top of Page

amyz

Canada
Posts

Posted - 05/27/2005 :  12:41:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the info, guys.

I still have several problems...

- I got this when I held onto Ctrl-Shift with File->Open:

Menu id=33996
run.section(FILE,Open)

Either syntax works, but the first one needs semicolon at the end.
I'd like to be able to replace 'FILE' by an actual filename, so reading in of data would be automated when I run the script in Tools->Worksheet script

- I got this from File->New:
Menu id=57600

But this command doesn't do anything when I run it

- I can set the Plot Designation (e.g., Menu id=38759 for 'Set as Z', as shown on script window) only after I've manually selected the desired columns. Is there a way to code in the column selection with the script?

- I'd like to Set Column Values for a dozen columns. When I click on Set Column Values, the code that shows up is Menu id=36433, yet nothing happens if I simply run this code. After typing in the desired formula, I held onto Ctrl-Shift when I pressed OK - nothing showed up in the script window though. So I tried simply typing in, e.g.,

col(3) = col(1) in the script window - and it works when I run it. However, it doesn't seem to recognize the syntax with which I index a cell in a different row [all values of that entire column become blank when I do the following], e.g.

col(3) = col(1)[I-1]
//[I-1] is the cell one row above; it works when I manually type it in Set Column Values, instead of using the script window



Thanks in advance for all the help!

~Amy



Go to Top of Page

verrallr@a

Canada
44 Posts

Posted - 05/27/2005 :  1:39:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It appears that when you want to run a Menu command, the format is:

menu -e 33996;

Richard.
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/27/2005 :  2:10:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
1. As Richard says, and as pointed out in the link above, the way to execute a menu command with LabTalk is "menu -e menuID;" where menuID is obtained by the Ctrl+Shift method.

menu -e 33996; // run File > Open
menu -e 38759; // set selected column as Z

2. Use this command to import a specific file from the Worksheet Script (substitute the actual file path\name, of course)...

open -w C:\MyData\MyFile.dat;

3. Use the copy command to copy a range of rows from one column to another.

Help > Programming > LabTalk Language Reference > Command Reference > Copy

Mike Buess
Origin WebRing Member
Go to Top of Page

amyz

Canada
Posts

Posted - 05/27/2005 :  2:51:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much, Richard and Mike.

- I'm wondering if there's a script/line of code to 'select' a certain column. e.g., in
menu -e 38759; // set selected column as Z,

or would I need to manually select the column first?

- Instead of copying a row to another, my example of
col(3) = col(1)[I-1]
is a simplified version of how I would like to Set Column Values:

col (7) = (col(4)[I+1] - col(4)[I-1])/(col(1)[I+1] - col (1)[I-1])

I'd also like to specify the rows (from ... to ...) of column 7 where I want this calculated value, as I could do via the menu command.

Thanks.

~Amy
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/27/2005 :  3:07:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Amy,

There are LabTalk commands for practically every menu item and I suggest that you look over the Programming Guide. In particular,

wks.col4.type=6;
- and -
worksheet -t 4 6;

are two ways to designate column 4 as Z. You can use loops to do the sort of column manipulation that you want...

get col(4) -e npt; // find # rows in col(4)
for(ii=2;ii<npt;ii++) {
col(7)[ii]=(col(4)[ii+1] - col(4)[ii-1])/(col(1)[ii+1] - col(1)[ii-1]);
};

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 05/27/2005 3:08:14 PM

Edited by - Mike Buess on 05/27/2005 3:09:30 PM
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