Custom Document Icons

I am writing an applescript studio application and was wondering If there was a way that I could add a custom icon to my documents. Can I do this in applescript or do I need to do this is Cocoa?

Anyone? In case you need it here’s my code:


set thepath to usrpath
set thefile to open for access thepath with write permission
write  datalist to thefile as list
close access thefile