Re: Scritping Fetch (3.0.3)
Re: Scritping Fetch (3.0.3)
- Subject: Re: Scritping Fetch (3.0.3)
- From: Richard 23 <email@hidden>
- Date: Wed, 29 Nov 2000 12:56:06 -0800
>
I'm trying to script Fetch to upload some zip files to my NT server.
>
>
I am using the following:
>
>
set theURL to "userid:password@ipaddress/directory/subdirectory/"
>
tell application "Fetch 3.0.3"
>
put into url theURL item "test.zip"
>
end tell
>
>
The passworded ftp site is accessible using Fetch normally or via a web
>
browser. However, when I run the script, I get the following message:
>
>
Fetch 3.0.3 got an error: Can't get URL
>
"userid:password@ipaddress/directory/subdirectory/"
>
>
Any ideas as to where I'm going wrong?
>
>
Regards
>
>
George Pitcher
FIrst you need to have a window open to the website, something like:
set Full_Dir to Root_Dir & Sub_Dir & theDir as string
log {|opening|:Full_Dir}
tell application "Fetch 3.0.3" to make new transfer window ==>
at beginning with properties {hostname:theHost, userid:usrId, ==>
password:usrPw as string, initial directory:Full_Dir}
-- theHost: y'know, like: "ftp.apple.com"
-- Root_Dir: path (without hostname) to your root directory
-- Sub_Dir: relative path from root to your working directory
-- theDir: relative path from Sub_Dir to target directory
-- I do this because if I'm using my daddy's site, the Root_Dir is
-- the entry point, Sub_Dir is my folder, then theDir gets to
-- the file's directory.
-- errors:
-- -3205: probably offline
-- -30003: invalid password,
-- -30006: directory does not exist
tell application "Fetch 3.0.3" to mkdir host theHost ,
path Root_Dir & theDir user usrId password usrPw
-- Finally here's how I upload with Fetch:
tell application "Fetch 3.0.3"
activate
set {use passive mode, display server messages} to {true, false}
put into transfer window 1 item alias thePath ==>
text format text binary format text
if thePath ends with ".pl" or thePath ends with ".cgi" then
-- -rwxr-xr-x standard for most cgi files
send to transfer window 1 ftp command {"SITE CHMOD 755 " &
fileName}
end if
end tell
If that isn't enough to get you on track let me know.
R23