[PythonCE] How to edit registry on pocketpc to change how IE displays python files.

Thomas Heller theller at python.net
Wed Jan 18 11:31:55 CET 2006


Fuzzyman <fuzzyman at voidspace.org.uk> writes:

> Stewart Midwinter wrote:
>
>>David, there should be a script that edits the registry for you, and
>>it comes with a shortcut to help run it.  Which version of PythonCE
>>did you install?
>>
>>
>>  
>>
> It didn't work for me. The one supplied seem to need running on the PC
> (using cereg.exe)  not the PocketPC - and it defines various *extra*
> entries as well. It didn't work for me yet anyway.
>
> I haven't yet taken the manual steps described to get it working. I was
> re-installing over a previous install.

Here is the script that I used (maybe it is from Luke):

#
#	Setup the registry to allow us to double click on python scripts
#
from _winreg import *

print "Setting up registry to allow\ndouble clicking of Python files to work"

#
#	Create the registry entries for ".py" and ".pyc" extensions
#
for Name in (".py", ".pyc"):
    Key = CreateKey(HKEY_CLASSES_ROOT, Name)
    SetValue(Key, None, REG_SZ, "Python.File")
    CloseKey(Key)

#
#	Create HKEY_CLASSES_ROOT\Python.File\Shell\Open\Command = "\Program Files\Python\Python.exe" "%1"
#
Key = CreateKey(HKEY_CLASSES_ROOT, "Python.File")
for Name in ("Shell","Open","Command"):
  New_Key= CreateKey(Key, Name)
  CloseKey(Key)
  Key = New_Key
SetValue(Key, None, REG_SZ, "\"\\Program Files\\Python\\Python.exe\" \"%1\"")
CloseKey(Key)

import time
time.sleep(5)

I did run it with 'execfile(r"\My Documents\Scripts\setup-registry.py")'
on the pocket PC itself, from within Python.

What I didn't achieve so far was to associate a useful icon with .py
files, maybe someone could post the registry entries for that?

Thomas




More information about the PythonCE mailing list