Posted By

iloveitaly on 06/06/09


Tagged

number cocoa python applescript character String c code char int carbon four


Versions (?)

Four Char Code From String in Python


 / Published in: Python
 

URL: http://www.cocoadev.com/index.pl?FourCharCode

Useful for SBApplication scripting bridge.

  1. def makeNumberFromCharCode(code):
  2. return (ord(code[0]) << 24) | (ord(code[1]) << 16) | (ord(code[2]) << 8) | ord(code[3])
  3.  
  4. # In Carbon / Cocoa:
  5. # FourCharCode code = 'abcd'
  6. # In Python:
  7. # code = makeNumberFromCharCode("abcd")

Report this snippet  

You need to login to post a comment.