idk if it works in the script console, im not sure if the script console has any know of the projects...
yu might have to put it in a button script.
and for the error it seems you are looping over projects not projectResources
Are you sure you called getAllProjectResources?
Edit: i just copied the code in the scriptconsole (apart from the modify translate) and it works for me...
Did you copy everything?