Note that there are some explanatory texts on larger screens.

plurals
  1. POdoes System Events in AppleScript support duplicating files?
    primarykey
    data
    text
    <p>I've been trying to get System Events to duplicate files in AppleScript and I've been failing :) I eventually always get the error "error "Files can not be copied." number -1717". So I changed my tactics and tried using the Finder to make sure what i was trying to do was correct. Here is the code that works:</p> <p>tell application "System Events"</p> <pre><code>set desktopFolder to (path to desktop folder) as string set fullPath to desktopFolder &amp; "Temp Export From DO" set theDOEntries to every file of folder "/Users/jkratz/Dropbox/Apps/Day One/Journal.dayone/entries" whose name extension is "doentry" repeat with DOEntry in theDOEntries set source to path of DOEntry log "Source file: " &amp; source set destination to fullPath as string log "Destination folder: " &amp; destination tell application "Finder" duplicate file source to folder destination with replacing end tell end repeat </code></pre> <p>end tell</p> <p>If I remove that last tell, so that it uses System Events, I get the same error noted above. The dictionary for System Events standard suite has a "duplicate" command so I'm not sure what is going on here. Also, "Learning AppleScript, 3rd ed" from APress notes: </p> <p>"One particularly annoying omission in System Events is that it can’t yet duplicate files and folders; if you need to do this, the Finder is your best bet."</p> <p>The 3rd edition is from 2010. It would seem that even in Mountain Lion this is still true. Can anyone confirm this? The 1717 error number lists everywhere else as a handler error and i'm not using handlers.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload