At first read there is a simple problem: you forgot that you coerced
sourceFolder into a string.
In the handler conVert, count of sourcefolder is the nR of charater
in the string sourceFolder, not the nbr of files.
So I made some changes (I didn't tested them because I don't own
Illustrator but it seems that there is the same kind of error in the
process handlers.
on conVert(sourceFolder) -- Here, sourceFolder is a string!
set sourceFolder to sourceFolder as alias
tell application "Finder" to set nbFiles to count of sourceFolder
try
set counter to 0
repeat with i from 1 to nbFiles
tell application "Finder" to set this_item to (item i of
sourceFolder)
my display(this_item) -- here this_item is a Finder's reference
set item_info to the info for this_item
my display(item_info)
if (folder of the item_info is true) and ¬
(alias of the item_info is true) then
process_folder(this_item)
else if (alias of the item_info is false) then
process_item(this_item)
end if
end repeat
tell application "Finder"
activate
display dialog (the counter as string) & " items have been
converted to Illustrator AIs." buttons {"Gracias!"} default button 1
end tell
on error msg
my showError("Something happened during conVert")
end try
end conVert