Hi,
in the documentation was stated that win32com .pys (PythonScript Files)
aren't recognized automatically by WSH
if you click on them.

This is due the fact that the pysFile which is the registry entry which
describes the .pys extension is incomplete.

it show only the following entries

---------------------------[snip]-------------------------------------------
---
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\pysFile]
@=""

[HKEY_CLASSES_ROOT\pysFile\ScriptEngine]
@="Python"
---------------------------[snip]-------------------------------------------
---

here is the registry export from RegEdit on Windows 2000 which show 
how it should be.

---------------------------[snip]-------------------------------------------
---
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\pysFile]
@="PythonScript File"
"EditFlags"=dword:00000000
"BrowserFlags"=dword:00000008

[HKEY_CLASSES_ROOT\pysFile\DefaultIcon]
@="E:\\Python21\\py.ico,0"

[HKEY_CLASSES_ROOT\pysFile\ScriptEngine]
@="Python"

[HKEY_CLASSES_ROOT\pysFile\Shell]
@=""

[HKEY_CLASSES_ROOT\pysFile\Shell\Open]
@="&Open"

[HKEY_CLASSES_ROOT\pysFile\Shell\Open\Command]
@="E:\\WINNT\\System32\\WScript.exe \"%1\" %*"

[HKEY_CLASSES_ROOT\pysFile\Shell\Open2]
@="Open &with Command Prompt"

[HKEY_CLASSES_ROOT\pysFile\Shell\Open2\Command]
@="E:\\WINNT\\System32\\CScript.exe \"%1\" %*"

[HKEY_CLASSES_ROOT\pysFile\ShellEx]

[HKEY_CLASSES_ROOT\pysFile\ShellEx\PropertySheetHandlers]

[HKEY_CLASSES_ROOT\pysFile\ShellEx\PropertySheetHandlers\WSHProps]
@="{60254CA5-953B-11CF-8C96-00AA00B8708C}"
---------------------------[snip]-------------------------------------------
---

The crucial part which makes WSH and Explorer aware of .pys as a script file
for WScript or CScript is the

HKEY_CLASSES_ROOT\pysFile\ShellEx\PropertySheetHandlers\WSHProps

Key which the GUID {60254CA5-953B-11CF-8C96-00AA00B8708C}

After adding this you get in explorer a script propertypage where you can
enter timeout etc.

The Open and Open2 keys associate .pys with wscript / cscript.

Remember "E:\\WINNT\\System32" is the Windows NT / 2000 System directory on
MY machine. 
It has to be changed accordingly to the target system.

After adding this to the registry double clickuing a .pys file and invoking
it with WScript works like a charm.

If you like to be able to launch .pys from the command prompt add also .pys
to the PATHEXT
environment variable within the SYSTEM environment.

Now you can type test.pys and WScript is started automagically.

Regards
-- Thomas Melzer 
----------------------------------------------------
bineo Network Solutions Gmbh
Germany
EMail: [EMAIL PROTECTED]


_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to