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

Last Update: 1/7/2019


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

  • Starting with Origin 2016, 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.
  • Another option is to save 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, regardless of file type. This is a good solution for those seeking maximum portability as you can save script with the workbook or project file.
  • 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