Set up Windows environment with python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim

    #1

    Set up Windows environment with python


    My company resells windows machines, and we install our software, and
    do a bunch of customization to make sure that all the desktop settings
    are optimal... we adjust the screen resolution, color depth, and
    referesh rate, remove shadows from menus and the mouse pointer, set
    the power management options, disable the screensaver, etc... (very
    long list)

    I've started doing most of what I want with ctypes:

    def disableShadows( ):
    # constants taken from WinUser.h in the PlatformSDK
    SPI_SETCURSORSH ADOW = 0x101B
    rv =
    ctypes.windll.u ser32.SystemPar ametersInfoA(SP I_SETCURSORSHAD OW, 0,
    False, win32con.SPIF_S ENDWININICHANGE )

    # remove shadows from menus
    SPI_SETDROPSHAD OW = 0x1025
    rv = ctypes.windll.u ser32.SystemPar ametersInfoA(SP I_SETDROPSHADOW ,
    0, False, win32con.SPIF_S ENDWININICHANGE )

    But I'm finding that none of the changes seem to be permanent. I'm
    wondering if I need to start changing the current Explorer theme
    information instead, or go right to the registry and start changing
    values.

    Desktop wallpaper changes work, but they aren't permanent... rebooting
    restores the previous desktop wallpaper.

    Does anyone have any experience with this sort of system preperation
    scripting?

    Thanks,
    -Jim

  • Brett Hoerner

    #2
    Re: Set up Windows environment with python

    I don't have experience with scipting this... but I know that
    resolution for example is stored in registry, and _that_ is what is
    loaded when you boot.

    I think most, if not all, of your changes will be found in the registry
    (for permenance).

    Also, have you checked out PyWin32? It's just a big pre-made wrapper
    for the Win32 stuff, not sure if it will be more/less work than ctypes
    but it could make it easier on you.

    PyWin32
    http://sourceforge.net/project/showf...group_id=78018

    Comment

    • Thomas Heller

      #3
      Re: Set up Windows environment with python

      "Jim" <mrmaple@gmail. com> writes:
      [color=blue]
      > My company resells windows machines, and we install our software, and
      > do a bunch of customization to make sure that all the desktop settings
      > are optimal... we adjust the screen resolution, color depth, and
      > referesh rate, remove shadows from menus and the mouse pointer, set
      > the power management options, disable the screensaver, etc... (very
      > long list)
      >
      > I've started doing most of what I want with ctypes:
      >
      > def disableShadows( ):
      > # constants taken from WinUser.h in the PlatformSDK
      > SPI_SETCURSORSH ADOW = 0x101B
      > rv =
      > ctypes.windll.u ser32.SystemPar ametersInfoA(SP I_SETCURSORSHAD OW, 0,
      > False, win32con.SPIF_S ENDWININICHANGE )
      >
      > # remove shadows from menus
      > SPI_SETDROPSHAD OW = 0x1025
      > rv = ctypes.windll.u ser32.SystemPar ametersInfoA(SP I_SETDROPSHADOW ,
      > 0, False, win32con.SPIF_S ENDWININICHANGE )
      >
      > But I'm finding that none of the changes seem to be permanent. I'm
      > wondering if I need to start changing the current Explorer theme
      > information instead, or go right to the registry and start changing
      > values.
      >
      > Desktop wallpaper changes work, but they aren't permanent... rebooting
      > restores the previous desktop wallpaper.
      >
      > Does anyone have any experience with this sort of system preperation
      > scripting?[/color]

      From looking at the MSDN docs, it seems you have to add
      SPIF_UPDATEINIF ILE (Writes the new system-wide parameter setting to the
      user profile) to the last argument.

      Thomas

      Comment

      • Jim

        #4
        Re: Set up Windows environment with python

        Thanks Thomas! That did it.

        I can now set the wallpaper, mouse shadows, menu shadows, and I can
        disable the screensaver.

        Does anyone know how I can adjust the power options? I want to make
        sure any hibernate or standby options are set to Never.

        Thanks,
        -Jim

        Comment

        Working...