Applescript vraagje

Hoi.. ik wil een script hebben dat van mijn /sites locatie alles upload (inclusief subdirectories) naar een FTP server. Het volgende script maakt een connectie en zet de local wel op /sites/ maar houdt dan op.. wie kan me helpen?


– begin user defined variables –
set myUserName to “XXX”
set myPass to “XXX”
set ftpServer to “XXX”
set initialPathOnFTPserver to “/” – directory to download
set local_folder to “~/sites”
– end user defined variables –

tell application “Transmit”
activate
set newWindow to make new document at end
tell newWindow
set your stuff to local_folder
connect to ftpServer as user myUserName with password myPass ¬
with initial path initialPathOnFTPserver with connection type FTP
upload item local_folder
disconnect
end tell
quit
end tell

Mijn nieuwe script werkt perfect:

Maar ik kan het niet toevoegen aan de folder actions… hoe doe ik dat?


– begin user defined variables –
set myUserName to “XXX”
set myPass to “XXX”
set ftpServer to “XXX”
set initialPathOnFTPserver to “/” – directory to download
set local_folder to “~/sites/”
– end user defined variables –

tell application “Transmit”

-- Create a new session window for the script
make new document at before front document

-- send commands to the frontmost document window
tell document 1
	if (connect to ftpServer as user myUserName with password myPass) then
		if (set your stuff to local_folder) then
			if (set their stuff to initialPathOnFTPserver) then
				
				(*

Begin synchronizing modified remote files with local files

Can specify the direction and method Transmit uses for synchronizing.
Direction can be: upload files / download files
Method can be: update / mirror
*)
synchronize direction upload files method mirror
else
display dialog (“An error occured, could not change remote folder”)
end if
else
display dialog (“An error occured, could not change local folder”)
end if
end if
end tell
end tell
end adding folder items to