2.7.23 impFile

Brief Information

Import file with predefined filter

Command Line Usage

1. impFile fname:="C:\Sample.wav" filtername:="WAV.oif" location:=system;

2. impFile fname="C:\Sample.wav" filtername="C:\Program Files\Origin8\Filters\wav.oif";

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
File Name fname

Input

string

fname$

Specify the filename(s) of the file(s) that will be imported. Click the browse button beside the list box to open one or more files and the filenames will be listed in the box.

Filter Name filtername

Input

string

Specify the filename(s) of the filter(s) that will be imported. Click the browse button to select the filter.

Filter Location location

Input

int

system

The location of the filter. This is only available when the filter name does not include full file path. Then the X-Function will find the filter from the selected location of the following list.
Option list

  • data:Data file folder
    The filter is located at the same folder as the data file.
  • system:Origin working filter folder
    The filter is located in Origin working filter folder, which is <Origin Installation Folder>\Filters\.
  • user:User filter folder
    The filter is located in User filter folder, which is <Origin User Folder>\Filters\.
  • page:In target Page
    The filter is stored in the target page (worksheet).
Output orng

Output

Range

<active>

The range for the imported data

See the syntax here.

Description

This X-Function can be used to import a file with a pre-defined filter. It is not listed in the menu and can only be accessed from script. A filter can be created with Import Wizard or X-Function iwfilter. To import the file correctly, the filter must be a valid one corresponding to the data file.

Examples

1. The following example will import a WAV sound file (assume it is C:\WAVData\Sample.wav) with the dialog.

a. Type impFile -d in the command window to open the dialog.
b. Before the X-Function dialog is open, an Open dialog will be popped up to select the file to be imported. Browse to the folder C:\WAVData. Select the file Sample.wav and click the Add File(s) button. Click OK to close the dialog box.
c. In the impFile dialog box, click the file browser button beside Filter Name edit box to select the filter <Origin Installation Folder>\Filters\WAV.oif.
d. Now you can see the list box for Filter Location is grayed and disabled as the Filter Name has included the full file path.
e. Click Ok to close the dialog and import the file.

2. The following script will import the WAV file without opening the dialog, which is equivalent to the operation in the example above.

impFile filename:= "C:\WAVData\Sample.wav" filtername:="wav.oif" location:=1;

3. The following example will use script to import all SPE files under a specific folder (assume it is C:\SPEData\) with the build-in SPE filter.

cd C:\SPEData;
findFiles ext:="*.spe";
impFile filtername:="spe.oif" location:=1;

Related X-Functions

cd, findFiles, impinfo, impASC, impWav, impSPE, impNetCDF