<doc>
  <legacy_id>2498</legacy_id>
  <name>copyResource</name>
  <type>function</type>
  <syntax>
    <example>copyResource(<i>file</i>,<i>destinationFile</i>,<i>resType</i>,{<i>resID</i> |<i> resName</i>}[,<i>newID</i>])</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Files, Folders, &amp; Resources</category>
  </classification>
  <references>
    <command tag="copy">copy Command</command>
    <function tag="setResource">setResource Function</function>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
  </platforms>
  <classes>
    <desktop/>
    <web/>
  </classes>
  <security>
    <disk access="???"/>
  </security>
  <summary>Copies a <glossary tag="resource">resource</glossary> from one <glossary tag="Mac OS">Mac OS</glossary> <keyword tag="file">file</keyword> to another.</summary>
  <examples>
    <example>get copyResource("Template","New Build","vers",1,1)</example>
    <example>put copyResource(theFile,anotherFile,"XCMD","SetPort") into trashVar</example>
    <example>get copyResource(field "Source",currentFile,nextResource,200)</example>
  </examples>
  <description>
    <p>Use the <b>copyResource</b> function to copy <glossary tag="resource">resources</glossary> (such as icons, externals, and version <glossary tag="resource">resources</glossary>) from one <keyword tag="file">file</keyword> to another.</p><p/><p><b>Parameters:</b></p><p>The <i>file</i> is the <glossary tag="file path">name and location</glossary> of the <keyword tag="file">file</keyword> containing the <glossary tag="resource">resource</glossary>. If you specify a name but not a location, LiveCode assumes the <keyword tag="file">file</keyword> is in the <property tag="defaultFolder">defaultFolder</property>.</p><p/><p>The <i>destinationFile</i> is the <glossary tag="file path">name and location</glossary> of the <keyword tag="file">file</keyword> you want to copy the <glossary tag="resource">resource</glossary> to.</p><p/><p>The <i>resType</i> is the 4-<keyword tag="character">character</keyword> type of the <glossary tag="resource">resource</glossary> you want to move.</p><p/><p>The <i>resID</i> is an <keyword tag="integer">integer</keyword> that specifies the resource ID of the <glossary tag="resource">resource</glossary> you want to copy.</p><p/><p>The <i>resName</i> is the name of the <glossary tag="resource">resource</glossary> you want to copy.</p><p/><p>The <i>newID</i> is an <keyword tag="integer">integer</keyword> that specifies the resource ID for the newly-copied <glossary tag="resource">resource</glossary>.</p><p/><p><b>Value:</b></p><p>The <b>copyResource</b> <control_st tag="function">function</control_st> always <glossary tag="return">returns</glossary> empty.</p><p/><p><b>Comments:</b></p><p>If the <i>file</i> does not exist, the <function tag="result">result</function> is set to "<code>can't find file</code>".</p><p/><p>If the <i>destinationFile</i> does not exist, the <b>copyResource</b> <control_st tag="function">function</control_st> creates the <keyword tag="file">file</keyword>, but the <function tag="result">result</function> is set to "<code>can't create resource fork for destination file</code>". If the <i>destinationFile</i> exists but has no <glossary tag="resource fork">resource fork</glossary>. the <b>copyResource</b> function creates the <glossary tag="resource fork">resource fork</glossary> and copies the <glossary tag="resource">resource</glossary> to it.</p><p/><p>If the <i>destinationFile</i> is open, the <function tag="result">result</function> is set to "<code>Can't open resource fork</code>".</p><p/><p>If you don't specify a <i>newID</i>, the new <glossary tag="resource">resource</glossary> has the same ID as the original <glossary tag="resource">resource</glossary>. Specifying a <i>newID</i> does not change the resource ID of the original <glossary tag="resource">resource</glossary> in the <keyword tag="file">file</keyword>; it only affects the copy in the <i>destinationFile</i>.</p>
  </description>
</doc>