<doc>
  <legacy_id>2118</legacy_id>
  <name>ask file</name>
  <type>command</type>
  <syntax>
    <example>ask file <i>prompt</i> [with <i>defaultFilePath</i>] [with filter <i>types</i>] [as sheet]</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Windows  Dialog Boxes</category>
    <category>Files, Folders,  Resources</category>
  </classification>
  <references>
    <command tag="answer file">answer file Command</command>
    <command tag="ask">ask Command</command>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
    <changed version="2.0"></changed>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
  </platforms>
  <classes>
    <desktop/>
    <web/>
  </classes>
  <security>
    <disk access="???"/>
  </security>
  <summary>Displays a standard Save <glossary tag="dialog box">dialog</glossary> for the user to enter a <keyword tag="file">file</keyword> name and specify a location.</summary>
  <examples>
    <example>ask file "Please name the file:"</example>
    <example>ask file "Save data as" with "/HD/Data Stacks/filedata.rev" as sheet</example>
    <example>ask file empty with "Untitled"</example>
    <example>ask file "Export picture as:" with filter "JPEG file,*.jpg"</example>
  </examples>
  <description>
    <p>Use the <b>ask file</b> <glossary tag="command">command</glossary> to let the user provide the <glossary tag="file path">name and location</glossary> of a new <keyword tag="file">file</keyword>.</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 <i>prompt</i> appears.</p><p>The <i>defaultFilePath</i> consists of a folder path, or a suggested file name, or both. The filename is the portion of the path after the last slash character (/). If a folder path is provided in the <i>defaultFilePath</i>, the <glossary tag="dialog box">dialog box</glossary> shows the contents of that <property tag="defaultFolder">folder</property>. Otherwise, it shows the contents of the last <property tag="defaultFolder">folder</property> you used with a <glossary tag="file dialog box">file dialog box</glossary>. If a suggested file name is provided in the <i>defaultFilePath</i>, it appears in the file name box.</p><p>The<i> types</i> <glossary tag="parameter">parameter</glossary> specifies which extensions are available at the bottom of the dialog box. A file type consists of an optional description, a line feed or comma, and a file extension specification:</p><p><i>  [description</i>],*.<i>extension</i></p><p/><p>You can include more than one file type by separating the file types with commas.</p><p/><p><img src="202652"/> <b>Cross-platform note:</b> The <i>types</i> <glossary tag="parameter">parameter</glossary> applies only to <glossary tag="Windows">Windows systems</glossary>. On <glossary tag="Mac OS">Mac OS</glossary> and <glossary tag="Unix">Unix systems</glossary>, this <glossary tag="parameter">parameter</glossary> has no effect.</p><p/><p><b>Comments:</b></p><p>The dialog box is the same one most applications use for the "Save" command in the File menu. (If the <b>systemFileSelector</b> <glossary tag="property">property</glossary> is set to true on <glossary tag="Mac OS">Mac OS</glossary> and <glossary tag="Windows">Windows systems</glossary>, and always on <glossary tag="Unix">Unix systems</glossary>, the <glossary tag="application">application</glossary> displays its own built-in <glossary tag="dialog box">dialog box</glossary>, instead of the one provided by the operating system.)</p><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 user cancels the <glossary tag="dialog box">dialog</glossary>, the <keyword tag="it">it</keyword> <glossary tag="variable">variable</glossary> is set to empty, and the <function tag="result">result</function> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> cancel.</p><p/><p><img src="202653"/> <b>Important!</b> The ask file command does not create the file. It only displays the dialog box and retrieves the path to the file the user specifies.</p><p/><p><b>Note:</b> On Windows, it is imperative not to name a file with one of the reserved device names: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8 and LPT9. Also do not use these names followed by an extension, for example, NUL.tx7.</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.</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><img src="202652"/> <b>Cross-platform note:</b> On <glossary tag="Mac OS">Mac OS systems</glossary> where Navigation Services is in use, if you don't specify a default file name, the file name box contains "untitled". On Unix and Windows systems, the file name box is empty when the <glossary tag="dialog box">dialog box</glossary> appears. Unix systems currently use LiveCode's built-in dialog box.</p><p/><p><b>Changes:</b></p><p>The ask file...as sheet form was introduced in version 2.0.</p>
  </description>
</doc>