4.47 FAQ-666 How to open the dialog in Origin by using LabTalk Script?
Last Update: 7/12/2018
A substantial number of the menu commands and tool bar buttons in Origin's graphical user interface (GUI) are implemented in LabTalk script. It is quite easy to view or locate the script that gets executed when a menu item or button is selected. This makes the Origin GUI an excellent source of example LabTalk scripts. These script files can be studied as examples or used as is in your own custom scripts. It is probably best not to modify Origin script files since Origin uses them as well. If you want to customize an Origin script file the safest method is to copy/paste the script to a file of your own before modifying it.
Open the Script window and press and hold down the CTRL and SHIFT keys while selecting the desired menu item or button. Origin will type to the Script window the Menu ID and the script - typically a run.section command - of the menu item or button that is selected. The menu item or button does not get executed. In Origin, the Menu ID can (in many cases) be executed by the LabTalk command menu -e ID. See LabTalk Help or the LabTalk Manual for more information on the menu -e ID command. Please note that menu IDs are subject to change from version to version so do not use menu IDs if future compatibility may be an issue.
identifies the location of the script that gets executed when a menu item or button is selected. The fileName argument identifies the path and filename of the Script file and the section argument identifies the section of code within the file that gets executed. If no path is specified then the file is located in the Origin software folder and if no file extension is specified a default extension of .OGS is assumed. Open the file with any text editor and search for the section name enclosed in square brackets - [section].
The menu id and the run.section command are still typed out to the Script window. In addition, the associated OGS file is opened in the Code Builder and the cursor is placed at the beginning of the section that gets executed.
For example, if you press and hold down the CTRL and SHIFT keys while selecting the File:Open menu item the following text is typed to the Script window.
Menu id=33996 (0x84cc)
The actual script that gets executed can be found in the [Open] section of the file FILE.OGS in the Origin software folder. Origin 7.5 and later versions opens the file FILE.OGS in the Code Builder and positions the cursor at the beginning of the [Open] section.