AppleScript & Stuffit Deluxe 7.0.3 & Fetch 4

Hello,

I trying to do the following on OS9… with Stuffit Deluxe v 7.0.3:

Stuff a whole folder and send it with Fetch to an FTP location.

But I get a script error at the Stuff stage: Impossible to get alias Macintosh HD:Documents:Backups

And at the Fetch stage I get an error: A reference was expected

Can someone help me please?
Thanks


--Déclaration des variables
set SourceFolder to "Macintosh HD:Documents:Backups"
set DestinationFile to "Macintosh HD:Documents:Incidents.sit"
set target_URL to "ftp://admin:nike4@10.192.120.250/share/"

--Compression du dossier avec un timeout de 20 minutes (20 x 60 secndes)
with timeout of 1200 seconds
	tell application "StuffIt Deluxe"
		stuff alias SourceFolder into alias DestinationFile
	end tell
end timeout

set zippedfile to "Macintosh HD:Documents:Backups:Incidents.sit"

--Envoi du fichier par Fetch à travers FTP
with timeout of 1200 seconds
	tell application "Fetch 4"
		put into target_URL item zippedfile
	end tell
end timeout

--Supprimer le fichier Archive

--Quitter les programmes
tell application "StuffIt Deluxe"
	quit
end tell

tell application "Fetch 4"
	quit
end tell

Model: iMac G4
Browser: Firefox 4.0.1
Operating System: Mac OS 9.2.x

OK so I have made something that works… See below.

But I would like to know how to catch any error on each stage and quit the script?

As I see the Fetch “put into” replaces automatically the previous file in the upload directory. Is this normal?

For the Fetch “put into” command must I specify “format Binhex” if what I am sending is a stuffed file containing documents and applications.

Thanks, Andrew


--Déclaration des variables
set myFolder to "Macintosh HD:Documents:Backups:" as alias

--Création du tableau d'alias
tell application "Finder"
	activate
	set aliasList to (items of myFolder) as alias list
end tell

--Création d'une nouvelle archive
tell application "StuffIt Deluxe"
	activate
	make new archive with properties {location:file "Macintosh HD:Documents:Sauvegarde.sit"}
end tell

--Compression des documents
with timeout of 1200 seconds
	tell application "StuffIt Deluxe"
		activate
		stuff aliasList into archive "Sauvegarde.sit" compression level maximum
		quit
	end tell
end timeout

--Déclaration de la variable
set myFile to "Macintosh HD:Documents:Sauvegarde.sit" as alias

--Envoi du fichier par FTP avec Fetch
with timeout of 1200 seconds
	tell application "Fetch 4"
		activate
		set theTransferWindow to make new transfer window at beginning with properties {hostname:"10.192.120.250", userid:"admin", password:"nike4", initial directory:"share/4D/"}
		put into theTransferWindow item myFile
		quit
	end tell
end timeout

--Supprime le fichier d'archive
tell application "Finder"
	activate
	select file "Sauvegarde.sit" of folder "Documents" of startup disk
	delete selection
	empty trash
end tell

Here’s how to error check as you asked…

try
	-- do some code
	-- if any of the code errors it automatically goes into the "on error" section and stops executing the rest of the code
on error theError number errorNumber
	-- this ends the script
	-- you could optionally display a dialog first showing theError and errorNumber to alert you of the problem
	return
end try