Copy File To 3 Different Destinations

Hi can someone help I’ve been trying to make this script work with no luck at all.
I want to be able to drag a file on to this script and have it copied to 3 different destinations. Thanks Dave

property storageFolder1 : ""
property storageFolder2 : ""
property storageFolder3 : ""

repeat
	display dialog "Click the buttons to set the location for the storage folders." & return & ¬
		"Folder 1: " & (storageFolder1 as text) & return & ¬
		"Folder 2: " & (storageFolder2 as text) & return & ¬
		"Folder 3: " & (storageFolder3 as text) buttons {"Folder 1", "Folder 2", "Folder 3", "Done"} default button 4
	
	if button returned of result is "Folder 1" then
		set storageFolder1 to choose folder with prompt "Pick the first storage folder"
	else if button returned of result is "Folder 2" then
		set storageFolder2 to choose folder with prompt "Pick the second storage folder"
	else if button returned of result is "Folder 3" then
		set storageFolder3 to choose folder with prompt "Pick the third storage folder"
		
	else
		exit repeat
	end if
end repeat

on open theFiles
	tell application "Finder"
		try
			move theFiles to storageFolder1 replacing ask
			move theFiles to storageFolder2 replacing ask
			move theFiles to storageFolder3 replacing ask
		on error errtext number errnum
			if errnum = 5038 then set errtext to "The requested folder is missing. Please select a new destination folder."
			beep
			display dialog errtext buttons {"OK"} default button 1
		end try
	end tell
end open

I’m being called to supper, but there is one thing I see. Display dialog can take up to three parameters so your setup at the beginning won’t work. You can make a list and use the “choose from list” command of the standard additions to allow you four choices (your three folders and okay or cancel).
Take a look at the standard additions dictionary and search the bbs for choose from list for more on how to set this up.
Off to dinner now…

Further to Dennis’s comments, you’ll also want to tell the Finder to ‘duplicate’ the files to those folders rather than ‘move’ them there.

Another option is one I’ve been playing with in my scripts lately.

try something like

set x to 0
property storageFolder1 : "" 
property storageFolder2 : "" 
property storageFolder3 : "" 

repeat until x is equal to 1

repeat 
display dialog "Click the buttons to set the location for the storage folders." & return & ¬
"Folder 1: " & (storageFolder1 as text) & return & ¬
"Folder 2: " & (storageFolder2 as text) & return & ¬
"Folder 3: " & (storageFolder3 as text) buttons {"Folder 1", "Folder 2", "Folder 3"}

if button returned of result is "Folder 1" then 
	set storageFolder1 to choose folder with prompt "Pick the first storage folder" 
else if button returned of result is "Folder 2" then 
	set storageFolder2 to choose folder with prompt "Pick the second storage folder" 
else if button returned of result is "Folder 3" then 
	set storageFolder3 to choose folder with prompt "Pick the third storage folder" 
end if

if storageFolder1 is not equal to "" and storageFolder2 is not equal to "" and storageFolder3 is not equal to "" then set x to 1
end repeat

That way x remains set to 0 (and thus the loop repeats) until all three paramaters have something in them. Once all three parameters have a value x is set to 1 and the repeat no longer executes. That reduces your number of buttons to 3 and accomplishes the same task.