Set up Windows environment with python

J

Jim

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
 
B

Brett Hoerner

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
 
T

Thomas Heller

Jim said:
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
 
J

Jim

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top