<?xml version="1.0" encoding="UTF-8"?>
<!--Arbortext, Inc., 1988-2017, v.4002-->
<!DOCTYPE pubsReference PUBLIC "-//PTC//DTD PUBS DITA Reference//EN"
 "K:\P27289\ArbortextDTDs\pubsDitabase\pubsDitabase.dtd">
<pubsReference id="help6182" xml:lang="zh_CN">
<title>preimporthook</title><?Pub Caret 11?>
<shortdesc></shortdesc>
<pubsRefbody>
<section><title></title><p><cmdname>preimporthook</cmdname></p><p
>Function prototype:</p> <p><codeph>hook(arr[])</codeph></p></section>
<section><title>Synopsis</title><p>Use with:</p><codeblock>add_hook(<varname
>hookname</varname>, <varname>func</varname>[, <varname>prepend</varname
>])
remove_hook(<varname>hookname</varname>, <varname>func</varname>)
</codeblock><p>where <varname>hookname</varname> is <cmdname>preimporthook</cmdname
>.</p><p>This hook is called before the import process begins, just
after the user supplies the desired parameters on the <uicontrol>Import
Document</uicontrol> dialog box. The hook function is passed an array
containing all the input parameters as specified on the <xref
format="dita" href="help5001.dita" scope="local"><cmdname>document_import</cmdname
></xref> function (or from the dialog box), and may override the settings
by altering the array. If the hook function returns <codeph>-1</codeph
>, the import operation will be cancelled, causing <cmdname>document_import</cmdname
> to return <codeph>-1</codeph>. If the hook modifies any of the parameters
in the array, it must return <codeph>1</codeph>. Otherwise, the function
should return <codeph>0</codeph>.</p></section>
<section><title>Argument</title><p><varname>arr</varname> is an array
parameter whose elements contain the <cmdname>document_import</cmdname
> parameters indexed as follows:</p><ul>
<li><p><codeph>1</codeph> — the input path name <parmname>inFile</parmname
></p></li>
<li><p><codeph>2</codeph> — the input file format <parmname>inFileFmt</parmname
></p></li>
<li><p><codeph>3</codeph> — the output path name <parmname>outFile</parmname
></p></li>
<li><p><codeph>4</codeph> — the map file path name <parmname>mapFile</parmname
></p></li>
<li><p><codeph>5</codeph> — the template file path name <parmname
>tmpltFile</parmname></p></li>
<li><p><codeph>6</codeph> — the boolean <parmname>grphEntRef</parmname
> value</p></li>
<li><p><codeph>7</codeph> — the log file path name <parmname>logFile</parmname
></p></li>
<li><p><codeph>8</codeph> — the boolean <parmname>batchMode</parmname
> value</p></li>
</ul></section>
<section><title>Example</title><p>In the following example, the hook
function forces the import process to use the entity method for graphics
by changing the <parmname>grphEntRef </parmname> parameter.</p><p
></p><codeblock>function PreImportHook(arr[]))
{
   arr[6] = 1;
   return 1; # signal array was changed
}
add_hook("preimporthook", "PreImportHook");
</codeblock></section>
</pubsRefbody>
</pubsReference>
