AppleScript icon bouncing up and down in the dock.

Hello All,

why is my applescript bouncing in the dock after i choose yes in the first dialogbox.
please help!



-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- part 1 do you want to copy files from SabNzb to MusicTemp?
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

set source1a to alias ("/Volumes/SabNzb/complete/" as POSIX file)
display dialog "Copy from SabNzb to MusicTemp?" buttons {"Yes", "No"} with title "Copy From News Server And Torrentz V1.0" with icon file "mac:Users:mamekedi:My Scripts:Icons:Gakuseisean-Ivista-2-Alarm-Help-and-Support.icns"


if result = {button returned:"Yes"} then
	
	
	tell application "Finder"
		try
			
			duplicate every item of source1a to destination
			display dialog "Copy from SabNzb to MusicTemp complete!" buttons {"OK"} default button "OK" with title "Copy From News Server And Torrentz V1.0" with icon file "mac:Users:mamekedi:My Scripts:Icons:Gakuseisean-Ivista-2-Alarm-Tick.icns"
			
		on error errMsg
			display dialog "Some files or folders already exists on destination" buttons {"Exit"} default button "Exit" with title "Copy From News Server And Torrentz V1.0" with icon file "mac:Users:mamekedi:My Scripts:Icons:Double-J-Design-Ravenna-3d-Alert.icns"
		end try
		
		
	end tell
	
	
	
else if result = {button returned:"No"} then
	
end if

-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- part 2 do you want to copy files from Transmission to MusicTemp?
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

set source2a to alias ("/Volumes/Transmission/Media/" as POSIX file)
display dialog "Copy from Transmission to MusicTemp?" buttons {"Yes", "No"} with title "Copy From News Server And Torrentz V1.0" with icon file "mac:Users:mamekedi:My Scripts:Icons:Gakuseisean-Ivista-2-Alarm-Help-and-Support.icns"


if result = {button returned:"Yes"} then
	
	
	tell application "Finder"
		try
			
			duplicate every item of source2a to destination
			display dialog "Copy from Transmission to MusicTemp complete!" buttons {"OK"} default button "OK" with title "Copy From News Server And Torrentz V1.0" with icon file "mac:Users:mamekedi:My Scripts:Icons:Gakuseisean-Ivista-2-Alarm-Tick.icns"
			
		on error errMsg
			display dialog "Some files or folders already exists on destination" buttons {"Exit"} default button "Exit" with title "Copy From News Server And Torrentz V1.0" with icon file "mac:Users:mamekedi:My Scripts:Icons:Double-J-Design-Ravenna-3d-Alert.icns"
		end try
		
		
	end tell
	
	
else if result = {button returned:"No"} then
	
end if


-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- part 3 do you want to delete all files from SabNzb?
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Hi,

because the Finder is not active at that moment.

add a line

activate

right after the first tell application “Finder” line

Hi.

It’s probably because you’re telling the Finder to display the subsequent dialogs and it needs to be brought to the front to do so. You could tell the Finder to activate before the second dialog (as I see Stefan’s already suggested), but it might be better to have the script itself display all the dialogs.



-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- part 1 do you want to copy files from SabNzb to MusicTemp?
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

set source1a to alias ("/Volumes/SabNzb/complete/" as POSIX file)
set chosenButton to button returned of (display dialog "Copy from SabNzb to MusicTemp?" buttons {"Yes", "No"} with title "Copy From News Server And Torrentz V1.0" with icon file "mac:Users:mamekedi:My Scripts:Icons:Gakuseisean-Ivista-2-Alarm-Help-and-Support.icns")


if chosenButton = "Yes" then
		
	try
		
		tell application "Finder" to duplicate every item of source1a to destination
		
		display dialog "Copy from SabNzb to MusicTemp complete!" buttons {"OK"} default button "OK" with title "Copy From News Server And Torrentz V1.0" with icon file "mac:Users:mamekedi:My Scripts:Icons:Gakuseisean-Ivista-2-Alarm-Tick.icns"
		
	on error errMsg
		display dialog "Some files or folders already exists on destination" buttons {"Exit"} default button "Exit" with title "Copy From News Server And Torrentz V1.0" with icon file "mac:Users:mamekedi:My Scripts:Icons:Double-J-Design-Ravenna-3d-Alert.icns"
	end try
	
	
else -- chosenButton = "No"
	
end if

-- Similarly with the subsequent parts.

Hello Nigel,

This works !!! Perfect

Thank you very much,

Marty