2.17 FAQ-428 How to run LabTalk script after import?

Last Update: 11/17/2020


There are several options for running LabTalk script after import to do post-processing of data (calculations, formatting, analysis, plotting):

  • If you are using one of the new Data Connector import methods, you can embed LabTalk script directly in the worksheet. LabTalk script entered into the Script tab of the Worksheet Properties dialog can be set to run After Import (this method works with any imported data). This is a good solution for those seeking maximum portability as the script can be saved with a template (.otwu), with the workbook (.ogwu) or project file (opju). See this OriginLab blog post for details.
  • If you are using the older X-Function-based import routines (e.g impASC), you can add LabTalk script to the Data: Import from File dialogs for ASCII, CSV, SPC or Excel files, with the option of saving your settings as a dialog Theme.
  • For most file types, you can add script to a filter for drag-and-drop import using the iwfilter dialog box. Using Excel file import as an example, click Preferences: Import Filter Manager... and select Excel in the Filter column of the Filter Manager dialog. Make sure the Support Drag and Drop checkbox is selected. Click Edit to open the Import and Export: iwfilter dialog, then type your LabTalk script in the Labtalk Script after Import box under General Import Setting. Click Save As to name and save the filter (.oif file) to the <Origin User File Folder>\Filters folder. To use the import filter, drag-and-drop an Excel file to Origin, A Select Filter dialog will appear. Choose your saved filter and click OK. The LabTalk script in the "Script after ..." box will be executed automatically on import (see Note1 below). Any import filter added by this procedure can also be used when importing via the File: Open dialog or during batch processing import operations (note that the batchProcess dialog itself, offers scripting options).
  • You can also save an import filter and add post-import scripting with the Import Wizard. While this option will appeal mostly to those importing ASCII files -- particularly files of complex structure -- it can be used when importing binary and other "user-defined" data types.


Note 1:This operation is not applicable to Famos, MDF and pClamp file formats.
Note 2: You can check the Open XF Dialog box under the General Import Setting section in the iwfilter dialog box and open the corresponding import dialog when importing data.


Keywords:LabTalk script, Post-Processing, Import Data, Import Filter, iwfilter, Worksheet Script, Worksheet Properties, Batch Processing