How do I make a callback in Applescript?

My script involves moving folders/items to a different disk. This usually takes a bit of time to transfer. Problem I run into is that the script performs the move command and since the command is successfully run, it continues to the next line.
Unfortunately by continuing before the transfer is complete, the rest of the script doesn’t work.
I’m trying to somehow have a callback where it waits till the transfer is complete before continuing.

The script is triggered via Folder Action
I use something along the lines of this:


tell application "finder"
    move addedItem to thisDestination
end tell

Have any ideas?

When I run this script, I get a beep after the file has been moved.

tell application "Finder"
	set addedItem to "/xxx/yyy.m4v"
	set thisDestination to "~/Desktop/zzz"
	do shell script "mv " & quoted form of addedItem & space & thisDestination
	beep
end tell

Hmm you are correct about this.
I’m trying to avoid using shell scripts because unfortunately this breaks the addedItem object and I can no longer reference it or it’s location(most likely because we moved it via shell script instead of Finder).

Is there a different solution for this? If not I’ll have to make do. Thanks

If you know the old location, and the new location, then you can reset the reference to it, after it moves, and before the beep.

You can also do something like this :

tell application "Finder"
	set fileName to "yyy.m4v"
	set addedItem to alias "Mac OS X:Users:adayzdone:Desktop:yyy.m4v"
set thisDestination to alias "Mac OS X:Users:adayzdone:Desktop:folder"
	move addedItem to thisDestination
	delay 1
	repeat
		tell (info for alias (thisDestination & fileName as string)) to set theStatus to busy status
		
		if theStatus then -- the file is busy, wait one second
			delay 1
		else if not theStatus then -- the file is not busy, continue your script
			exit repeat
		end if
	end repeat
	
	-- Do things with the file	
end tell

How would I do that?

Is it possible to grab the filename from the addedItem object?
Something like name & extension of addedItem ?

tell (info for addedItem) to set theName to name