[python-win32] How to block ctrl-alt-delete on Windows 7?

2010-10-28 Thread Alec Bennett
I'm working on a kiosk application, and am trying to prevent people from breaking out of our interface with Windows shortcut keys. Using pyHook I've managed to block the Windows keys, control keys and alt keys, but ctrl-alt-delete still works. This thread suggests that the combination is allo

Re: [python-win32] Problem accessing GetFontData in Windows API

2010-01-22 Thread Alec Bennett
Thanks for the tips. Using that method I'm able to obtain the filename for about 75% of the fonts in my Windows directory, but I can't resolve fonts with names such as this: - the font's name is Arno Pro. It shows up in font choosers with names like "Arno Pro", "Arno Pro Caption", "Arno Pro Dis

Re: [python-win32] Problem accessing GetFontData in Windows API

2010-01-22 Thread Alec Bennett
> A much better solution is to search through the registry > values in HKLM\SOFTWARE\Microsoft\Windows Three things concern me with this method: 1) if I understand correctly, Windows appends the language to the font title. In other words, for German the Arial font is "arial german". Normally th

[python-win32] Problem accessing GetFontData in Windows API

2010-01-22 Thread Alec Bennett
I'm trying to access the following function from the Windows API: http://msdn.microsoft.com/en-us/library/dd144885(VS.85).aspx I'm sure I'm drastically over simplifying, but I'm testing it like this: import win32api print win32api.GetFontData() This of course errors out with "AttributeError: fu

[python-win32] faster way to get printer status?

2009-08-04 Thread Alec Bennett
I'm trying to get the online/offline status of a printer, and using WMI I'm finding it very slow. Here's the code I'm working, maybe there's some way to opimize it? Or some other way? I'm able to use win32print to query the status of an online printer, but not to find out whether its online or

[python-win32] how to get the statusbar text of a window?

2009-05-29 Thread Alec Bennett
I'm trying to read the statusbar text of a window under Python. I'm guessing win32gui is the way to go, and thought the GetWindowText function was promising, but alas I can't get it to return anything other than the text of the titlebar. Can anyone think of any clever ways to do this? Here's

Re: [python-win32] Programatically activating secondary monitor?

2009-04-30 Thread Alec Bennett
to windows control panel --> display --> settings and clicking on that second monitor. --- On Thu, 4/30/09, Tim Golden wrote: > From: Tim Golden > Subject: Re: [python-win32] Programatically activating secondary monitor? > To: > Cc: python-win32@python.org > Date:

[python-win32] Programatically activating secondary monitor?

2009-04-30 Thread Alec Bennett
I'm wondering if there's a way to enable a second monitor in Windows from Python or otherwise programatically? Currently I use the utility UltraMon, which works, but it sure would be nice to be able to do this from Python. ___ python-win3

[python-win32] problem getting printer status in Windows

2009-04-20 Thread Alec Bennett
I'm having trouble getting the printer status in Windows. Ideally I'd like to get the info contained in the "Status" column when you open a printer from the Windows control panel --> printers. I've been using the routine pasted at the end of this email, which works for some printers, but not o

[python-win32] How to enumerate com ports?

2009-04-03 Thread Alec Bennett
I'd like to get a list of available com ports on a Windows machine. I've seen some reference to a function EnumSerialPorts but can't find any documentation. Thanks for any help. ___ python-win32 mailing list python-win32@python.

Re: [python-win32] Pythonwin starts, displays main window, interactive window 'frame', then exits

2008-12-12 Thread Alec Bennett
Run it from commandline and see if an error message is printed the console? --- On Thu, 12/11/08, John_Nowlan wrote: > From: John_Nowlan > Subject: [python-win32] Pythonwin starts, displays main window, interactive > window 'frame', then exits > To: python-win32@python.org > Date: Thursday,

Re: [python-win32] rebooting windows from Python

2008-12-05 Thread Alec Bennett
> Is this capability not already part of XP? > I've got my machines set to go to sleep after 1 hour, > no programming needed. > Right click on the Desktop, Properties, ScreenSaver, Power. A couple of problems with doing it like that: 1) if you set your computer to go to sleep after X minutes, you

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Alec Bennett
> I've been using the following method that I found on > ActiveState's Cookbook, which I modified a little > (http://code.activestate.com/recipes/360649/): Does that method ever hang during shutdown? I've tested the WMI method a few times and got one hang, where it was asking me to terminate a pr

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Alec Bennett
And thus I say for the second time in 24 hours: Eureka! For anyone else coming down this path, here's how to shutdown, reboot or logoff Windows, each with the option to force the action. In other words, you can force Windows to reboot even if its asking if you want to save a document. nLogOf

Re: [python-win32] rebooting windows from Python?

2008-12-05 Thread Alec Bennett
> > import wmi > > wmi.WMI(privileges=["Shutdown"]).Win32_OperatingSystem()[0].Shutdown () > > Stylin, works. The only thing it doesn't do that I personally need it to do is the "force shutdown". In other words "shutdown.exe -f". I found this page with some hints but couldn't get it to work:

Re: [python-win32] Walking the registry and creating reg files

2008-12-04 Thread Alec Bennett
Reg files are just text files, so why not just create the text files yourself? Here's a reg file for example: REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Gizmoware\Whatever] "Name"="Yada" "Number"="something" --- On Thu, 12/4/08, Tim Roberts <[EMAIL PROTECTED]> wrote: > From: Tim Roberts <[EMAI

[python-win32] rebooting windows from Python?

2008-12-04 Thread Alec Bennett
I'm wondering if there's some way to reboot or shutdown Windows from within Python? I can log out like this: win32api.ExitWindowsEx(4) And according to the documentation, I should be able to shutdown like this: win32api.ExitWindowsEx(2) But that returns the following error: 'A required priv

Re: [python-win32] turning monitors off from Python?

2008-12-04 Thread Alec Bennett
Eureka! In case anyone else comes down this path, the trick is to use HWND_BROADCAST to send the message to all windows. So the code to turn off all monitors: SC_MONITORPOWER = 0xF170 win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2) According to the doc

Re: [python-win32] turning monitors off from Python?

2008-12-04 Thread Alec Bennett
> The article you mention suggests using the desktop window > handle -- available via GetDesktopWindow (). You might try that? I have a feeling that was progress, but still no reaction on my monitors. Here's the code including the new clue: SC_MONITORPOWER = 0xF170 handle = win32gui.GetDesktopWi

[python-win32] turning monitors off from Python?

2008-12-04 Thread Alec Bennett
I'm trying to turn a monitor off from a Python script. I can do this using the program "wizmo", so its possible from Windows. I found this script which describes a method using SendMessage: http://fci-h.blogspot.com/2007/03/turn-off-your-monitor-via-code-c.html Translated to Python, here's what

Re: [python-win32] How to clear a "dead" icon from system tray?

2008-04-10 Thread Alec Bennett
> Interesting. You're saying that the normal > del kb is not enough to clean this up? Whoops, user error. I had declared my com object as global so I could delete it from somewhere else, but forgot to declare it as global before deleting it Works fine now, thanks. And for anyone coming dow

Re: [python-win32] How to clear a "dead" icon from system tray?

2008-04-10 Thread Alec Bennett
client.Dispatch("Kbd.mfSoftkeys") kb.LoadKeyboard("keyboard_file.kbd") --- Tim Roberts <[EMAIL PROTECTED]> wrote: > Alec Bennett wrote: > > I'm ending task on a process that has a system tray icon, which works but > > it leaves an icon > be

[python-win32] How to clear a "dead" icon from system tray?

2008-04-10 Thread Alec Bennett
I'm ending task on a process that has a system tray icon, which works but it leaves an icon behind in the system tray, which only goes away if I mouse over it. Can anyone think of a way to force a refresh of the system tray without mousing over it? I know this is adding duct tape over duct tape,

[python-win32] possible to save the output of TTS to a WAV file?

2008-03-07 Thread Alec Bennett
I'm trying to save the output of some TTS to a sound file, is this possible? Here's how I'm doing the TTS, though am certainly open to other methods: import pythoncom, win32com import win32api, win32com.client pythoncom.CoInitialize () s = win32com.client.Dispatch("SAPI.SpVoice") s.Speak("hi the

Re: [python-win32] How to access the Outlook Express

2008-01-24 Thread Alec Bennett
What do you need to do to it? If you're simply remote controlling it (triggering commands), you might look into PostMessage. --- Tim Roberts <[EMAIL PROTECTED]> wrote: > Michel Claveau wrote: > > > >> I don't believe that Outlook Express exposes an > IDispatch interface. I > >> think that

Re: [python-win32] Creating a process and getting a handle

2008-01-22 Thread Alec Bennett
Please post what you find on this, I'm curious too. If you do go the enum windows route, It thought I'd post my notes on this since I recently got it working. It's somewhat confusing (for me at least) since it uses a callback: # Callback function for findWindowHandle def windowEnumerationHandler