[Pythonmac-SIG] Read Strings from Resources

Jack Jansen Jack.Jansen at cwi.nl
Tue Dec 21 23:14:19 CET 2004


On 20-dec-04, at 20:06, wicked-witch at gmx.net wrote:

> I working on a project, where I want to read a STR# resource and write 
> it
> into an xml file.
> With Carbon.Res I can easily access the file an read the string 
> Resources
> for each ID. But with the Res.Get1Resource('STR#', id).data I get all 
> the
> strings in the list in one string only. Is there a method in python 
> like
> GetIndSting or something like it?

To my surprise there isn't! And nobody ever complained!

The problem is that the Carbon modules are generated automatically, and 
GetIndString is declared in TextUtils.h, not in Resource.h, so it isn't 
picked up.

I've filed a bug report (#1089399), so it'll be fixed, but that's a 
long term thing (not before 2.5). In the short term you'll have to 
parse the STR# resource yourself. I'm not 100% sure, but I think 
they're just a null-byte separated list. If they're something else (a 
list of Pascal strings?) I'll just hope someone will chime in.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman



More information about the Pythonmac-SIG mailing list