How to make choose file present only docs with given extensions?

So I got a 4-letter creator code from Apple. I want “choose file” to only show the relevant documents that my app can open. I know there’s an optional argument “of type {list of plain text}”, but I don’t know what this list of texts should be; should I stuff in the file extension? Or creator code? I tried both and neither worked.

Also in Xcode I’ve set Document Types under “Info.plist Entries” setting. I gave values to the following entries:

Name: (some java-dotted-string-like name)
Extension: (my document extension name)
OS Types: (the creator code)

So what am I missing to make it happen? Thanks!

A related question: in my app I create documents via do shell script. I assume in this way the documents won’t come with the creator code/file type set? I tried this to set the creator code:


tell app "finder"
  set creator type of myFile to "ABCD"
end

“ABCD” is a creator code. But I got a “stack overflow” error (?). What am I missing here?