<doc>
  <legacy_id>1925</legacy_id>
  <name>answer file with type</name>
  <type>command</type>
  <syntax>
    <example>answer file[s] <i>prompt</i> [with <i>defaultPath</i>] [with type <i>types</i> [or type <i>types</i> ...]] <i>windowTitle</i>] [as sheet]</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Windows &amp; Dialog Boxes</category>
    <category>Files, Folders, &amp; Resources</category>
  </classification>
  <references>
    <command tag="answer file">answer file Command</command>
  </references>
  <history>
    <introduced version="2.6">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
  </platforms>
  <classes>
    <desktop/>
    <web/>
  </classes>
  <security>
    <disk access="???"/>
  </security>
  <summary>Displays a <glossary tag="file dialog box">standard file dialog</glossary> for the user to select a <keyword tag="file">file</keyword>.</summary>
  <examples>
    <example>answer file "Select a file to delete:"</example>
    <example>answer files "Select the files you wish to process:"</example>
    <example>answer file "Input:" with "/Macintosh HD/"</example>
    <example>answer file (field "Prompt") with type "LiveCode Stacks|rev|RSTK"</example>
    <example>answer files "Select the images you wish to view:" with type "JPEG Images|jpg|JPEG" \</example>
  </examples>
  <description>
    <p>Use the <b>answer file</b> command when a <glossary tag="handler">handler</glossary> needs the <glossary tag="file path">file path</glossary> of a <keyword tag="file">file</keyword> before continuing.</p><p/><p><b>Parameters:</b></p><p>The <i>prompt</i> is a <keyword tag="string">string</keyword> (or any <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to a <keyword tag="string">string</keyword>). If you specify empty, no <glossary tag="prompt">prompt</glossary> appears.</p><p>The <i>defaultPath</i> is the <glossary tag="file path">name and location</glossary> of the <property tag="defaultFolder">folder</property> whose contents are listed when the <glossary tag="dialog box">dialog box</glossary> appears. If no <i>defaultPath</i> is specified, the <glossary tag="dialog box">dialog box</glossary> lists the contents of the last folder you used with a <glossary tag="file dialog box">file dialog box</glossary>.</p><p>The <i>windowTitle</i>, if specified, appears in the <glossary tag="title bar">title bar</glossary> of the <glossary tag="dialog box">dialog box</glossary>. If no <i>windowTitle</i> is given, the <glossary tag="title bar">title bar</glossary> is blank. (This <glossary tag="parameter">parameter</glossary> has no effect on <glossary tag="Mac OS">Mac OS systems</glossary>, because <glossary tag="Mac OS">Mac OS</glossary> <glossary tag="file dialog box">file dialog</glossary> boxes don't have a <glossary tag="title bar">title bar</glossary>.)</p><p>Use the <i>types</i> <glossary tag="parameter">parameter</glossary> to specify which <function tag="files">files</function> should appear and be available for selection. Each set of types is a return-delimited list of values of the form "tag|extensions|filetypes".</p><p/><p><b>Comments:</b></p><p>The dialog box displayed is the same one most programs use for the "Open" command in the File menu.</p><p>The absolute file path of the file the user chose is placed in the <b>it</b> <glossary tag="variable">variable</glossary>. If the answer files form is used, a return-delimited list of such paths is placed in the <b>it</b> variable. If the user cancels the <glossary tag="dialog box">dialog</glossary>, the <keyword tag="it">it</keyword> <glossary tag="variable">variable</glossary> is set to empty. If <i>types</i> are specified, the result function will return the tag of the corresponding type selected from the supplied drop-down list.</p><p/><p><img src="202653"/> <b>Important!</b> The <command tag="answer file">answer file command</command> does not open the <keyword tag="file">file</keyword>. It only displays the dialog box and retrieves the path to the file the user specifies.</p><p/><p>If more than one type is specified, a drop-down list containing the tags will be displayed allowing the user to select which types of files to display. (This list is always displayed on Windows systems).</p><p/><p>If the as sheet form is used, the dialog box appears as a sheet on OS X systems. On other systems, the as sheet form has no effect and the dialog box appears normally. Attempting to open a sheet from within another sheet displays the second <i>stack</i> as a <glossary tag="modal dialog box">modal dialog box</glossary> instead.  To give a dialog box a prompt when using the as sheet form a non-empty title must be provided.  This will cause the prompt to appear in the same place it would if as sheet was not being used.</p><p/><p>If the <b>systemFileSelector</b> <glossary tag="property">property</glossary> is set to false, LiveCode's built-in <glossary tag="dialog box">dialog box</glossary> is used instead of the operating system's <glossary tag="file dialog box">standard file dialog</glossary>.</p><p/><p><b>Changes:</b></p><p>The answer file ... with type ... form was introduced in version 2.6.</p>
  </description>
</doc>