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

2008-12-05 Thread Tim Golden
Tim Roberts wrote: Alec Bennett wrote: 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

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

2008-12-05 Thread Tim Golden
Mike Driscoll wrote: We're doing what amounts to a registry session audit here at work, so I need to walk a specific set of subfolders in our registry and get the contents thereof. The subfolders will vary from user to user. I found Tim Golden's excellent registry walking script on his website

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

2008-12-05 Thread Alec Bennett
code import wmi wmi.WMI(privileges=[Shutdown]).Win32_OperatingSystem()[0].Shutdown () /code 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] rebooting windows from Python?

2008-12-05 Thread Tim Golden
Alec Bennett wrote: code import wmi wmi.WMI(privileges=[Shutdown]).Win32_OperatingSystem()[0].Shutdown () /code 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

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. code

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

2008-12-05 Thread Mike Driscoll
Tim Roberts wrote: Mike Driscoll wrote: We're doing what amounts to a registry session audit here at work, so I need to walk a specific set of subfolders in our registry and get the contents thereof. The subfolders will vary from user to user. I found Tim Golden's excellent registry walking

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

2008-12-05 Thread Tim Golden
Dahlstrom, Roger wrote: If you can read the registry, you can save it without any other special permissions. It is just text. Just export a branch of your own registry and open it with notepad to see the format. I do it all the time, it works fine. You're quite right, Roger, and other

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

2008-12-05 Thread Mike Driscoll
Tim Golden wrote: div class=moz-text-flowed style=font-family: -moz-fixedDahlstrom, Roger wrote: If you can read the registry, you can save it without any other special permissions. It is just text. Just export a branch of your own registry and open it with notepad to see the format. I do

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

2008-12-05 Thread Dahlstrom, Roger
Well, sure the registry itself is not text, but the keynames contained within it are, and so are the values, once you've read them. Basically what I'm saying is not that you need *no* permissions, just that you don't need any *special* permissions - if you have permission to read it and

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

2008-12-05 Thread Tim Roberts
Dahlstrom, Roger wrote: ... Basically what I'm saying is not that you need *no* permissions, just that you don't need any *special* permissions - if you have permission to read it and enumerate the subkeys, that is (at least in my experience, maybe I'm not doing exactly what the request

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

2008-12-05 Thread Mike Driscoll
Alec, 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

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

2008-12-05 Thread Dahlstrom, Roger
Well, like I said, I've never done it in Python, and this is going back a bit, so some things might be different, but I'm not talking about RegSaveKey or RegRestoreKey, I'm talking about using EnumKey and CreateKey. As far as I can remember, I didn't have any special permissions for that.

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

2008-12-05 Thread Tim Roberts
Dahlstrom, Roger wrote: Well, like I said, I've never done it in Python, and this is going back a bit, so some things might be different, but I'm not talking about RegSaveKey or RegRestoreKey, I'm talking about using EnumKey and CreateKey. As far as I can remember, I didn't have any

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

2008-12-05 Thread Dahlstrom, Roger
I think my mistake was assuming that reading the values was going to be sufficient. For all the purposes I've used, it was. For my edification, what's the functional difference? I mean, what I was doing was able to walk the registry, extract information, save it for later, modify it, then

[python-win32] Simulating a mouse click - lParam

2008-12-05 Thread Rickey, Kyle W
Let's say I've got a window for which I want to simulate a mouse click at a specific x, y coordinate. I already have the hwnd but I'm not sure how to construct the lParam. I've used SendMessage in the past to click on buttons, etc., but I knew their hwnds. How do I construct the lParam. Per the

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'll

Re: [python-win32] rebooting windows from Python

2008-12-05 Thread Tony Cappellini
To me the bigger criticism is that there are probably 600 other programs that do the same thing, but what fun would it be for me to use someone else's program... got it. I'll take a look at your program. ___ python-win32 mailing list

Re: [python-win32] Simulating a mouse click - lParam

2008-12-05 Thread Tim Roberts
Rickey, Kyle W wrote: Let’s say I’ve got a window for which I want to simulate a mouse click at a specific x, y coordinate. I already have the hwnd but I’m not sure how to construct the lParam. I’ve used SendMessage in the past to click on buttons, etc., but I knew their hwnds. How do I

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

2008-12-05 Thread Tim Roberts
Dahlstrom, Roger wrote: I think my mistake was assuming that reading the values was going to be sufficient. For all the purposes I've used, it was. For my edification, what's the functional difference? I mean, what I was doing was able to walk the registry, extract information, save it

Re: [python-win32] Simulating a mouse click - lParam

2008-12-05 Thread Rickey, Kyle W
Thanks Tim. I used the following to select my tab of interest: TCM_SETCURSEL = 0x130C win32gui.SendMessage(hwnd, TCM_SETCURSEL, 3, 0) However, according to MSDN: http://msdn.microsoft.com/en-us/library/bb760612(VS.85).aspx Remarks A tab control does not send a TCN_SELCHANGING or

Re: [python-win32] Simulating a mouse click - lParam

2008-12-05 Thread Rickey, Kyle W
Apparently I jumped the gun. I tried: lParam = (y 16) | x win32gui.SendMessage(top_hwnd, win32con.WM_LBUTTONDOWN, 0, lParam) win32gui.SendMessage(top_hwnd, win32con.WM_LBUTTONUP, 0, lParam) with x and y 1st being on-screen coordinates, and 2nd with x and y being referenced from the corner of

Re: [python-win32] Simulating a mouse click - lParam

2008-12-05 Thread Tim Roberts
Rickey, Kyle W wrote: Thanks Tim. I used the following to select my tab of interest: TCM_SETCURSEL = 0x130C win32gui.SendMessage(hwnd, TCM_SETCURSEL, 3, 0) However, according to MSDN: http://msdn.microsoft.com/en-us/library/bb760612(VS.85).aspx Remarks A tab control does not send a

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

2008-12-05 Thread Dahlstrom, Roger
OK - so if I'm correct in understanding this, let's say hypothetically, I have something like so... HKLM... something something else something else something else If I were to use my operation, and export the entire tree, I would get a