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
 Menu/toolbar command script

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
amyz Posted - 05/26/2005 : 2:05:47 PM
[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
7   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 05/27/2005 : 3:07:01 PM
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
amyz Posted - 05/27/2005 : 2:51:33 PM
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
Mike Buess Posted - 05/27/2005 : 2:10:08 PM
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
verrallr@a Posted - 05/27/2005 : 1:39:18 PM
It appears that when you want to run a Menu command, the format is:

menu -e 33996;

Richard.
amyz Posted - 05/27/2005 : 12:41:29 PM
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



Leo_Li Posted - 05/26/2005 : 9:44:43 PM
or just press "Ctrl+Shift" when clicking a toolbar button or menuitem.
Mike Buess Posted - 05/26/2005 : 2:29:13 PM
You should find what you need here...

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

Mike Buess
Origin WebRing Member

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