Win32: silent script

Holger Jannsen holger at phoenix-edv.netzservice.de
Tue Jul 6 09:45:59 EDT 1999


Ok, that's a possibility.
Problem is that Windows link files with extensions like .py and .py
to python.exe (take a look at registry!). This causes in installation
of python under Windows. Don't like to change registry!

To start pythonw.exe in that links in windows-menu I've to specify
the whole path to that file... Ouch, I really didn't want that!;-(

What's about the other way:
How could I set the 'minimized window' option in that link by python-code?

That the source how I create that links:

def createLink(filePath, linkPath, args, descr, wrkngDir):
        "creates a link to a file"
        import pythoncom
        from win32com.shell import shell
        #get the shell interface
        sh = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None,
pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
        #get an IPersist interface
        persist = sh.QueryInterface(pythoncom.IID_IPersistFile)
        #set the data
        sh.SetPath( filePath )
        sh.SetDescription(descr)
        sh.SetWorkingDirectory(wrkngDir)
        sh.SetArguments(args)
        #save the link itself.
        persist.Save(linkPath, 1)  

I think there must be a 'sh.SetWindowsMode' or something like that?!?

>...
> Use pythonw.exe.  Its entire purpose in life is to make the console
> window unnecessary.
>...

Ciao,
Holger




More information about the Python-list mailing list