• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
duplicate file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

duplicate file


  • Subject: duplicate file
  • From: RJay Hansen <email@hidden>
  • Date: Thu, 24 Mar 2016 14:45:30 -0500

I’m writing a script that will take user chosen pdf file(s) and upload them to a user chosen Dropbox folder then send an email to the folder’s owner. I’m trying to use the Finder to copy the file to the Dropbox folder. Here is what I have:

set theseItems to (choose file with prompt "select a pdf to upload" with multiple selections allowed)

tell application "Finder"


--set up paths to the folders
set bluePath to get (POSIX path of (path to home folder))
set bluePath to bluePath & "Dropbox/ Blue"
set conniePath to get (POSIX path of (path to home folder))
set conniePath to conniePath & "Dropbox/ Connie"
set greenPath to get (POSIX path of (path to home folder))
set greenPath to greenPath & "Dropbox/ Green"
set orangePath to get (POSIX path of (path to home folder))
set orangePath to orangePath & "Dropbox/ Orange"
set pinkPath to get (POSIX path of (path to home folder))
set pinkPath to pinkPath & "Dropbox/ Pink"
end tell

set fileList to {}

--choose the folder we're going to upload to
choose from list {"Blue", "Connie", "Green", "Orange", "Pink"} with prompt "Choose the team Dropbox folder"
set theTeam to result

if item 1 of theTeam is "Blue" then
set thePath to bluePath
else if item 1 of theTeam is "Connie" then
set thePath to conniePath
else if item 1 of theTeam is "Green" then
set thePath to greenPath
else if item 1 of theTeam is "Orange" then
set thePath to orangePath
else if item 1 of theTeam is "Pink" then
set thePath to pinkPath
--else
-- return
end if

tell application "Finder"
repeat with i from 1 to count of theseItems
set thisItem to item i of theseItems
duplicate file thisItem to thePath
set the last item of fileList to thisItem


end repeat
end tell

Result: error "Finder got an error: AppleEvent handler failed." number -10000

I haven’t been able to figure this one out. Any help is appreciated.

Thanks,
RJay
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: duplicate file
      • From: "Stockly, Ed" <email@hidden>
    • Re: duplicate file
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: New Calendar Scripting Guide from Apple
  • Next by Date: Re: duplicate file
  • Previous by thread: Re: Mac Automation Scripting Guide [was Re: New Calendar Scripting Guide from Apple]
  • Next by thread: Re: duplicate file
  • Index(es):
    • Date
    • Thread