Set up Windows environment with python

Discussion in 'Python' started by Jim, Sep 29, 2005.

  1. Jim

    Jim Guest

    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_SETCURSORSHADOW = 0x101B
    rv =
    ctypes.windll.user32.SystemParametersInfoA(SPI_SETCURSORSHADOW, 0,
    False, win32con.SPIF_SENDWININICHANGE)

    # remove shadows from menus
    SPI_SETDROPSHADOW = 0x1025
    rv = ctypes.windll.user32.SystemParametersInfoA(SPI_SETDROPSHADOW,
    0, False, win32con.SPIF_SENDWININICHANGE)

    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
    Jim, Sep 29, 2005
    #1
    1. Advertising

  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/showfiles.php?group_id=78018
    Brett Hoerner, Sep 29, 2005
    #2
    1. Advertising

  3. "Jim" <> writes:

    > 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_SETCURSORSHADOW = 0x101B
    > rv =
    > ctypes.windll.user32.SystemParametersInfoA(SPI_SETCURSORSHADOW, 0,
    > False, win32con.SPIF_SENDWININICHANGE)
    >
    > # remove shadows from menus
    > SPI_SETDROPSHADOW = 0x1025
    > rv = ctypes.windll.user32.SystemParametersInfoA(SPI_SETDROPSHADOW,
    > 0, False, win32con.SPIF_SENDWININICHANGE)
    >
    > 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?


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

    Thomas
    Thomas Heller, Sep 29, 2005
    #3
  4. Jim

    Jim Guest

    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
    Jim, Sep 29, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. The Jetman
    Replies:
    0
    Views:
    277
    The Jetman
    Jan 15, 2004
  2. Fuzzyman

    Set Windows Environment Variable

    Fuzzyman, Mar 30, 2006, in forum: Python
    Replies:
    6
    Views:
    8,582
    Fuzzyman
    Mar 30, 2006
  3. Replies:
    5
    Views:
    641
  4. Replies:
    1
    Views:
    1,364
    Derek Martin
    Oct 14, 2008
  5. Slickuser

    set environment in perl through windows

    Slickuser, Jun 13, 2009, in forum: Perl Misc
    Replies:
    1
    Views:
    258
    J├╝rgen Exner
    Jun 13, 2009
Loading...

Share This Page