| Author |  Topic  |           | 
              
                | hajo_old
 
                Germany141 Posts
 | 
                    
                      |  Posted - 02/27/2003 :  10:13:37 AM           
 |  
                      | Hello, all 
 I yust want to ask if it is possible to directly invoke menu commands within OriginC or LabTalk?
 
 In special I want to call the menu command:
 "Analysis" -> "Average Multiple Curves"
 within an OriginC function.
 
 How can I do this? Whats the function called, that performs the task?
 
 Thanks
 Hajo
 
 -- --
 Dipl.-Ing. Hans-Joerg Koch
 Siemens VDO, Regensburg
 
 SVDO_Origin1
 |  | 
              
                | Mike Buess
 
                USA3037 Posts
 | 
                    
                      |  Posted - 02/27/2003 :  10:42:20 AM           
 |  
                      | Hi Hajo, 
 You can find out what a menu command does as follows.
 
 1> Open script window.
 2> Press <Ctrl>+<Shift> and select the menu item you're interested in.
 3> The menu ID for that command shows up in the script window.
 4> Additionally, if the command launches a LabTalk script then the relevant run.section() command shows up in the script window and the scrift file opens to that section in CodeBuilder.
 
 When I tried that with Analysis -> Average Multiple Curves I saw the following in the script window...
 
 Menu id=34160
 run.section(GRANALY,AveCurves)
 
 So there are two methods you can use to run that menu command from LabTalk (or OriginC with LT_execute).
 
 1> menu -e 34160; // run the command with the given menuID.
 2> run.section(GRANALY,AveCurves); // run the script section
 
 Note that menuIDs can change from one Origin version to the next, so method 2 is more reliable.
 
 Mike Buess
 Origin WebRing Member
 |  
                      |  |  | 
              
                | hajo_old
 
                Germany141 Posts
 | 
                    
                      |  Posted - 02/27/2003 :  10:50:18 AM           
 |  
                      | Thanks Mike 
 is that feature somewhere documented?
 
 Hajo
 
 -- --
 Dipl.-Ing. Hans-Joerg Koch
 Siemens VDO, Regensburg
 
 SVDO_Origin1
 |  
                      |  |  | 
              
                | Mike Buess
 
                USA3037 Posts
 | 
                    
                      |  Posted - 02/27/2003 :  11:26:54 AM           
 |  
                      | It's mentioned under the "menu" command description in the LabTalk programming guide. (Look for the "-e ID" option.) The feature has been around at least since Origin 5.0, probably longer. 
 Mike Buess
 Origin WebRing Member
 
 Edited by - Mike Buess on 02/27/2003  12:20:31 PM
 |  
                      |  |  | 
              
                | CoMic
 
                Germany4 Posts
 | 
                    
                      |  Posted - 03/08/2024 :  05:32:11 AM           
 |  
                      | This is a review of a very old topic. Currently, when using CTRL+SHIFT, the XFunction Code Builder opens up. So the oldfashioned approach no longer works, which is a pity.
 
 What I am to do with the cope snippet that appears is totally unclear and as to my search completely undocumented.
 
 The functionality I am looking for is to have a scripting command that does calculations and outputs result sheets just the same way as manual calling the menu would do.
 
 DLR-VE
 |  
                      |  |  | 
              
                | jasmine_chan
 
                ChinaPosts
 | 
                    
                      |  Posted - 03/26/2024 :  06:24:54 AM           
 |  
                      | Hi, you can open the X-Function dialog(not code builder), then click the top-right triangle button. Choose Generate Script at the menu bottom so that you can run the script in LT to do the same thing. 
 see details on
 https://www.originlab.com/doc/LabTalk/Tutorials/Tutorial-XF#Generate_Script_from_X-Function_Dialog
 
 
 quote:Originally posted by CoMic
 
 This is a review of a very old topic.
 Currently, when using CTRL+SHIFT, the XFunction Code Builder opens up. So the oldfashioned approach no longer works, which is a pity.
 
 What I am to do with the cope snippet that appears is totally unclear and as to my search completely undocumented.
 
 The functionality I am looking for is to have a scripting command that does calculations and outputs result sheets just the same way as manual calling the menu would do.
 
 DLR-VE
 
 
 |  
                      | Edited by - jasmine_chan on 03/26/2024  06:26:08 AM
 |  
                      |  |  | 
              
                | CoMic
 
                Germany4 Posts
 | 
                    
                      |  Posted - 04/03/2024 :  10:49:54 AM           
 |  
                      | Hi Jasmine thank you for your reply. I tried it out on several functions and some work like charm (e.g. grubbs, freqcounts), whereas others throw an 'X-Function not supported'-error (e.g. OneSampleTtest), at least on my system. Why some work and others don't is not obvious to me.
 KR
 Michael
 
 DLR-VE
 |  
                      |  |  | 
              
                | jasmine_chan
 
                ChinaPosts
 | 
                    
                      |  Posted - 04/06/2024 :  11:06:52 PM           
 |  
                      | Indeed some XFs are designed as script-not-accessible, so Generate Script is not applicable....in such case, you can search OneSampleTtest on https://www.originlab.com/doc You will find ttest1 can be called by script  https://www.originlab.com/doc/en/X-Function/ref/ttest1
 
 
 
 quote:Originally posted by CoMic
 
 Hi Jasmine
 thank you for your reply. I tried it out on several functions and some work like charm (e.g. grubbs, freqcounts), whereas others throw an 'X-Function not supported'-error (e.g. OneSampleTtest), at least on my system. Why some work and others don't is not obvious to me.
 KR
 Michael
 
 DLR-VE
 
 
 |  
                      |  |  | 
              
                |  |  Topic  |           |