Creating Aliases, random errors

I’m trying to make a script that will create an Alias file for an InDesign file on a network volume. I can get it to work, some of the time. On my 10.5 computer this script works 100% of the time. Testing it on a 10.4 or 10.6 computer, I get errors on what seems to be a random basis. In 10.4 the script works and will make the alias 100% of the time but reports an error about 80% of the time. In 10.6, the alias is made about 20% of the time and reports an error 80-100% of the time.
I have tried varying forms of the script, including converting the original file location to unicode text for 10.4, to setting up a script object within the script to run as more of a literal script. In testing on all my computers I could make the alias 100% of the time with a simple 3 line script with locations hard coded in. But using any sort of variable seems to throw an error.
I can’t target only 10.5 computers since I have 30+ users spread over varying operating systems right now. Plus some of the users are not computer savvy at all, and the script MUST work properly 100% of the time. I can’t tell them “well just ignore the error message”. I’m talking about old grannies (using that term lovingly) who can be confused by an OK button.
I’ve read over most of the posts dealing with Aliases here, and there is not much discussion of errors like this. I’m inclined to think it’s a Finder Bug of some fashion. Does any one else have an experience like this, or workarounds that work well?

So here’s some script.
The user has an InDesign doc opened, with some text that denotes a number that is part of our filing system. If the location of the alias file to be made is the same as the actual document, skip over step; else make the alias in this folder location.


--make aliases for each area
repeat with i from 1 to count of myAreas
	try
		set newAliasPath to calculateClipperFolderPath((area of item i of myAreas & issue of item i of myAreas & (characters 3 thru 4 of theYear as string)))
		if (myFilePath & docName as string) is not equal to (newAliasPath & ": CDD:" & docName) then --if not the saved doc
			tell application "Finder"
				if not (exists alias (newAliasPath & ": CDD:" & docName)) then --don't do if already exists file
					set newAlias to make alias at (newAliasPath & ": CDD") to (myFilePath & docName as string)
				end if
			end tell
		end if
	on error
		set missedMakingAlias to true
		--set a flag to display warning at end of operation
		copy (area of item i of myAreas) to end of missedAliases
		--copy missed areas to a list
	end try
end repeat

Here’s a version that I fixed up to work in 10.4, it wanted unicode text for the file locations.


--make aliases for each area
repeat with i from 1 to count of myAreas
	try
		set newAliasPath to calculateClipperFolderPath((area of item i of myAreas & issue of item i of myAreas & (characters 3 thru 4 of theYear as string)))
		
		set newAliasLocation to (newAliasPath & ": CDD") as Unicode text
		set origFileLocation to (myFilePath & docName) as Unicode text
		
		if (myFilePath & docName as string) is not equal to (newAliasPath & ": CDD:" & docName) then --if not the saved doc
			tell application "Finder"
				if not (exists alias ((newAliasPath & ": CDD:" & docName) as string)) then --don't do if already exists file
					
					set newAlias to make alias at newAliasLocation to origFileLocation
				end if
			end tell
		end if
	on error
		set missedMakingAlias to true
		--set a flag to display warning at end of operation
		copy (area of item i of myAreas) to end of missedAliases
		--copy missed areas to a list
	end try
end repeat

if missedMakingAlias then
	display dialog "There was a problem making aliases for some areas." & return & listToTextWReturns(missedAliases) with icon 2
else
	display dialog "Document saved and aliases filed." with icon 1 giving up after 3
end if

And on 10.6 I tried this, script inside a script step, but generally no dice


--make aliases for each area
repeat with i from 1 to count of myAreas
	try
		set newAliasPath to calculateClipperFolderPath((area of item i of myAreas & issue of item i of myAreas & (characters 3 thru 4 of theYear as string)))
		
		set newAliasLocation to (newAliasPath & ": CDD") as Unicode text
		set origFileLocation to (myFilePath & docName) as Unicode text
		
		--set newAliasLocation to newAliasLocation as Unicode text
		--set origFileLocation to origFileLocation as Unicode text
		if (myFilePath & docName as string) is not equal to (newAliasPath & ": CDD:" & docName) then --if not the saved doc
			tell application "Finder"
				if not (exists alias ((newAliasPath & ": CDD:" & docName) as string)) then --don't do if already exists file
					
					--make a literal script object and run it, since that seems to work
					--a lot better than a command inside this script
					--running a hard coded location script always produces correct alias file
					set instantScript to run script ("tell app \"Finder\"
make alias at \"" & newAliasLocation & "\" to \"" & origFileLocation & "\"
end tell" as string)
					
				end if
			end tell
		end if
	on error
		set missedMakingAlias to true
		--set a flag to display warning at end of operation
		copy (area of item i of myAreas) to end of missedAliases
		--copy missed areas to a list
	end try
end repeat

This works 100% of the time, but not helpful in any programmatic way


tell application "Finder"
	make alias at "Clippers2010:Clippers2010-00000:00026:00026_04_10: CDD" to "Clippers2010:Clippers2010-00000:00001:00001_06_10: CDD:1A_TEST.indd"
end tell

Hi,

your file and folder references are just string paths.
Actually the Finder expects file specifiers or an alias specifier for the folder

Try


tell application "Finder"
	make alias at folder newAliasLocation to file origFileLocation
end tell