I am trying to download a file from an ftp server using Transmit application… i am using the following code…
tell application “Transmit”
connect document 1 to “17.65.xx.xxx” as user “xxxxxx” with password “xxx” with connection type “ftp”
end tell
I am getting the following error:
Applescript Error: Transmit got Error: NSReceiversCantHandleCommandScriptError.
Anyone know what I am doing wrong here?
Once I am connected to the ftp server, I want to go one step further and download a folder onto a folder on the desktop… has anybody got ideas on how to do this?
There are sample scripts available from Panic but if you are running Tiger and the latest version of Transmit, Automator might be the best approach since Transmit’s “Download” action is very easy to configure.
Can you give some more details about what you want to achieve with script?
Downloading the content of one folder to another folder can be done with this script, taken from the example-scripts and slightly modified.
property ftp_password : "" -- Password to FTP-Server
property ftp_user : "" -- Login for FTP-Server
property ftp_server : "" -- FTP-Server
property ftp_directory : "" -- Directory to your Blog
property local_destination : "" -- Local Destination
with timeout of 1800 seconds
try
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 current session of document 1
if (connect to ftp_server as user ftp_user with password ftp_password) then
if (set your stuff to local_destination) then
if (set their stuff to ftp_directory) then
synchronize method mirror direction download files with automatically determine time offset
else
display dialog ("An error occured, could not change remote folder")
end if
else
display dialog ("An error occured, could not change local folder to Sites")
end if
end if
end tell
close document 1
end tell
on error {}
-- it will hit this if the event takes longer than 1800 seconds
display dialog "AppleEvent timed out"
end try
end timeout
Unfortunately you get an annoying message from Transmit when the copy is finished and the script will not continue, until you press ok - still looking for a solution.
Transmit’s dictionary includes the following. Maybe it will solve the problem.
SuppressAppleScriptAlerts boolean – (inherited from the “application” class) Set whether Transmit displays errors during AppleScript execution (on by default).