[Pythonmac-SIG] How to change values in the resource fork

Just van Rossum just@letterror.com
Tue, 8 Feb 2000 14:31:49 +0100


"""
At 11:53 AM +0100 08-02-2000, Pieter Claerhout wrote:
>Hello,
>
>can anyone tell me how I can change values in
>a #STR resource of my script, for example to
>store preferences in? Is there a tutorial or a
>place in the docs where I can find more info?
"""

#(untested)

import Res, struct

resRef = Res.OpenResFile(myResFile)

resType = '????'
resID = 126

myStrRes = Res.Get1Resource(resType, resID)

print myStrRes.data
myStrRes.data = "new data"

myStrRes.ChangedResource()
myStrRes.WriteResource()

Res.CloseResFile(resRef)


#just