error number -10004

Hi,
I have a script that generate an error number -10004. The script is doing what it is supposed to do but I am curious what the message means and why it occurs.
This is the code :

[code]set theDesk to (path to desktop) as Unicode text
set bootDisk to (path to startup disk) as Unicode text
set startFolder to alias (bootDisk & “Applications:Xboard:Engines”)
–set targetFolder to POSIX path of (“usr:bin”)
set targetFolder to POSIX path of (theDesk & “testfolder”)
set enginesFolder to (bootDisk & “Applications:Xboard:Engines”)

tell application “Finder”
set theFoldList to the name of every folder of entire contents of startFolder as list
if theFoldList is {} then
return
end if

try
	repeat with i from 1 to number of items in theFoldList
		set theSub to (enginesFolder & ":" & item i of theFoldList) as alias
		set theSubFolder to (enginesFolder & ":" & item i of theFoldList)
		set theSubList to the name of files of theSub as list
		if theSubList is {} then
			exit repeat
		end if
		repeat with y from 1 to number of items in theSubList
			set theName to item y of theSubList
			set theLInk to POSIX path of (theSubFolder & ":" & theName)
			try
				do shell script "ln -s " & theLInk & " " & targetFolder with administrator privileges
			on error errMsg number errNum
				if errNum = 1 then
					set y to y + 1
				end if
			end try
		end repeat
	end repeat
end try

end tell[/code]
Replies in Apple scrip editor are:
tell application “Finder”
do shell script “ln -s ‘/Applications/Xboard/Engines/Stockfish/stockfish-201’ ‘/Users/teun/Desktop/testfolder’” with administrator privileges
→ error number -10004
end tell
tell current application
do shell script “ln -s ‘/Applications/Xboard/Engines/Stockfish/stockfish-201’ ‘/Users/teun/Desktop/testfolder’” with administrator privileges
→ “”

Can anyone tell me what is going on ?

Hi,

this is a privilege violation error.
do shell script with administrator privileges doesn’t work within an application tell block.

See the section “Scripting Addition Security” in AppleScript Release Notes - 10.6 Changes

Thanks Stefan,
The information in the release note was very useful.
Adding "tell current application to " do shell script "ln -s " & theLInk & " " & targetFolder with administrator privileges, solved the “problem”

regards,
imai