Jump to content

Window Info not showing very much


Recommended Posts

I am trying to make something that walks a person through a procedure in an MMC. Let's say gpedit.msc or computer management for example. I want the USER to expand Windows Settings, and wait until they do. Normally a winwaitactive would be fine, but the AutoIt Window Info doesn't change when the Windows Settings folder is expanded. It also doesn't change when anything is updated on the right side of the MMC.

Any ideas how I could tell when a user has expanded the items on the left and/or when the settings themselves are visible on the right?

Thanks

Link to comment
Share on other sites

Ummm, why do you want the user to mess with the MMC? Can't you do this on a domain level? Also, you may want to see if you can do this by command line.

This is to teach them how to do it, not to do it for them. I want to provide guidance once they reach a certain point.

Link to comment
Share on other sites

My WInfo tells me that the list in gpedit for example is a SysTreeView, this can be managed with the GuiTreeView Management UDF(comes with AutoIt, look in the helpfile).

I tried coming up with an example, but my Group Policy Editor crashes when I run it for some unknown reason.. probably has something to do with that the UDF tries to write/read from the editors memory, causing some crash...

Anywho this is what I tried:

#Include <GuiTreeView.au3>

Dim $sWinClass = "[CLASS:MMCMainFrame]"

If Not WinExists($sWinClass) Then ShellExecute("gpedit.msc")
WinWait($sWinClass)

Sleep(1500)

$hWindow = WinGetHandle("[CLASS:MMCMainFrame]")
$hControl = ControlGetHandle($hWindow, "", "SysTreeView321")

While 1
    If Not WinExists($sWinClass) Then Exit
    $iItem = _GUICtrlTreeView_GetSelection($hControl)
    If Not $iItem Then ContinueLoop
    $sItemText = _GUICtrlTreeView_GetText($hControl, $iItem)
    ConsoleWrite($sItemText & @LF)
WEnd

Perhaps it'll work for you.

Link to comment
Share on other sites

It crashed for me too.

I was trying to learn more about what you have in the while loop, so I ran this after opening the gpedit.msc:

CODE
While 1

If Not WinExists($sWinClass) Then Exit

$iItem = _GUICtrlTreeView_GetSelection($hControl)

ConsoleWrite($iItem)

Just to see what would be found. It came back with several pages of this over and over. "0x000E4F280x000E4F280x000E4F28". I mean a very long line of it.

So it is easy to see when the MMC is open, but I don't see how to check to see if "Administrative Templates" has been selected.

Link to comment
Share on other sites

when using ConsoleWrite to you need to append @LF to the end of the command, otherwise everything will come out on one line.

With my previous example it would've been possible to just compare the text of the selected item against "Administrative Templates", and then take action from there.

The issue with the crash might be a bug within the GuiTreeView Management UDF, or it might just be that the Group Policy Editor is.. odd of sorts, which causes it to crash when it has its memory written to. :/

Link to comment
Share on other sites

This is to teach them how to do it, not to do it for them. I want to provide guidance once they reach a certain point.

Not to be a pain, but unless your in a classroom type setting, normally users don't mess with the MMC. You can really screw up a PC that way. If that is something you are really intent on, just do some screen shots with instructions. Keep it simple.

It will also depend on what snap-in is loaded on the PC in question. On my home PC, I have no snap-ins loaded, I could load them, but like I said, you can do all this with remote tools and keep your users out. If you want to teach, just remote in to their PC and walk them through it. Really, I'm not trying to be a pain to you. I just hate to see you go through a large amount of work. To each his own however.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...