Simple ftp upload?

Heres my issue. I have a client that sends me a .txt file every day that I need to upload to a server. Using Entourage, when that email arrives, I can have it automatically save the attachment to specified location, then it can run an applescript.

So basically I want to tell it to run an applescript that uploads that one file to a certain location on a server. I’ve seen some examples, although when I run them through the Apple Script editor, they don’t seem to work (plus I know nothing about applescript).

Any ideas?

Buy Danny Goodman’s “AppleScript Handbook” from SpiderWorks
Buy Transmit (which is scriptable) from Panic

Hi,

You can use the url access scripting scripting addition. You can see the parameters by opening its dictionary although some parameters may not work in OSX. Here’s and example that I just tested again:

set this_item to “Macintosh HD:Users:kel:Desktop:MySite:index.html”
set fullURL to “ftp://UserName:Password@ftpHost
tell application “URL Access Scripting”
upload alias this_item to fullURL replacing yes with progress without binhexing
end tell

It uploads to ftp the index.html page located in the folder MySite on my desktop. Replace UserName and Password with yours. You get the ftpHost name from whatever site you’re uploading to. Something like:

ftpmysite.somewhere.net

gl,

Nice work Kel,

I’m up and running. Thx.

-r

Spoke to soon. I can get the script to work fine, but for some reason Microsoft Entourage gives me a script error everytime I try and run it. Is there some other program I can use to run that script once a day?

Guess this could do it. would take any other suggestions though:
http://www.macupdate.com/info.php/id/7486

Hi tetuanrp,

You can make your own AppleScript app from the Script Editor. Just save it as an application (I don’t know what the wording is in Panther for application).

Later on, you might want to add error checking like if it doesn’t connect the first time you can try again. You might want to change it so that the password is not visible in your script also.

I have to think about why Entourage won’t run the script. Maybe it’s meant to be a Visual Basic script (I think that’s the name) and not an AppleScript.

A lot of this might depend on how you’re saving the script.

gl,

Cool. I could save it as an application, but basically I’m trying to figure out a way to have the script run every day on its own. I suppose I could have it run at startup everytime I boot by adding it as a startup program.

I did some Entourage research and came up with:
http://www.entourage.mvps.org/error/page.html

I’m getting error -192 (its a big page, you may want to Control-F it), and its saying a new update for Entourage fixes it. I’m downloading that right now and will test it.

(Just documenting this for anyone who has this similar issues)

-r

Problem solved.

Go here for the latest office update:
http://www.versiontracker.com/dyn/moreinfo/macosx/24851

Just found this site today. Great resource.

I wonder what “pre-SR1 Entourage” means in that error explaination.

Unfortunately it just so happens that my connection is’nt working right at the moment so I couldn’t test the script in Entourage.

Thanks for the update,

Hmmm. Of course I stumble upon something else.

The file I receive every day to be uploaded is a .txt file (10324.txt), and when entourage saves it into the folder which I set as a rule, it doesnt seem to overwrite it, but rename it (1032[1].txt). I don’t think I have the option to overwrite a file as a rule in entourage, but maybe I run a script first which deteles the file.

So when I receive the email every day, entourage will
1-run deletion script
2-save file to folder
3-run upload script

I’m looking for a simple deletion script. Let me know if there is an easy on (I’m sure its not difficult, this is actually my frist day writing applescripts.)

Looks like in entourage you can only run one script per rule, so that doesnt allow me to do seperate sripts that will trash the file, then save it.

So I tried one script which uploads the file, then deletes it right after. Although, looks like only part of it is uploading because I think the deletion script causes it to stop. Here is what I got:

set this_item to “Macintosh HD:Users:Admin:Documents:Clients:Shomex:BDE:10324.txt”
set fullURL to “ftp://shomex:jobfair@bestdiversityemployers.com/shomex/Htdocs/bde/bulkpost/
tell application “URL Access Scripting”
upload alias this_item to fullURL replacing yes with progress without binhexing
end tell
tell application “Finder”
delete file “Macintosh HD:Users:Admin:Documents:Clients:Shomex:BDE:10324.txt”
end tell

Is there a way to say, once file is completely uploaded, run deletion script?

Just before the Finder tell block for the delete, try adding a delay for testing.

do shell script “sleep 20” – 20 seconds

See if the file uploads completely.

It seems to be working on my comp, but I’m just uploading a tiny file and not doing anything after the upload.

gl,