I need some help with the following script i made.
Everything works except the move to trash part at the end -I believe the part where i want to check if the upload has succeeded by passing the returned boolean to theUpload parameter is where my script is a bit off.
Please feel free to help me out here
set theServerAddress to "[url=ftp://ftp.iwanttouse.com]ftp.iwanttouse.com[/url]"
set theUserName to "username"
set thePassword to "password"
set theRemoteDirectory to "/home/hd1/folder1/subfolder1"
set theLocalDirectory to downloads folder
set theUpload to false as boolean
set this_item to choose file with prompt "Choose file:" default location the path to downloads folder
try
-- Connecteren with the ftp server
tell application "Transmit"
tell current tab of (make new document at end)
connect to address theServerAddress as user theUserName with password thePassword with initial path theRemoteDirectory with protocol SFTP
-- Upload the File
tell remote browser
upload item at path this_item
if boolean returned is true then
set theUpload to true as boolean
end if
end tell
-- Disconnect
close remote browser
end tell
quit
end tell
-- Move the uploaded file to the trash
if theUpload = true then
tell application "Finder"
move this_item to trash
end tell
end if
end try