Jump to content

Win7 apps resisting automation?


scotw
 Share

Recommended Posts

Hello all,

I'm trying what should be a simple automation of system settings. To do that I start the "SystemPropertiesPerformance" tool and then attempt to send some keys to it.

Nothing I try seems to work. I started with simple

Send("!l{ENTER}"}

After using WinActivate() to ensure that the window had focus.

Which did not work, so I moved to using window info and Control Click

ControlClick("Performance Options", "&Let Windows choose what's best for my computer", "[iD:2021]")

Which reports success, but the app does not respond. It responds to normal keyboard input at all times.

Are there a section of Win7 apps/components that resist automation or am I missing something obvious?

My thanks for any tips or info.

Link to comment
Share on other sites

From what I can see "SystemPropertiesPerformance" only has 8 controls. In other words the scrolling window under "Custom:" is it's own control so, if you are trying to select / deselect any of these options you are going to have to use X,Y window cords and MouseClick() instead of ControlClick().

For instance this will work: selecting the option, pausing, then selecting another option

Run("SystemPropertiesPerformance")
WinWaitActive("Performance Options")
ControlClick("Performance Options", "&Let Windows choose what's best for my computer", "[ID:2021]")
Sleep(500)
ControlClick("Performance Options", "Adjust for &best appearance", "[ID:2022]")
Sleep(500)
ControlClick("Performance Options", "Adjust for best &performance", "[ID:2023]")
Sleep(500)
;;; adding MouseCoordMode, 0 to set to active window coords
AutoItSetOption("MouseCoordMode",0)
;;; make sure that you select "window" in the Options >> coord mode of AutoIt Window Info Tool
MouseClick("left", 40, 246);;; should click on the "Enable Aero Peak" check box
Sleep(500)
Link to comment
Share on other sites

I am thinking that your main issue is that you are not using #requireadmin.

When I try the following on my win7 64 box without #requireadmin at the top, nothing happens.

Hopefully this example can help:

#RequireAdmin
ShellExecute(@SystemDir & "SystemPropertiesPerformance.exe")
WinWait("Performance Options")
ControlClick("[CLASS:#32770]", "&Let Windows choose what's best for my computer", "[CLASS:Button; INSTANCE:1]")
Sleep(500)
ControlClick("[CLASS:#32770]", "Adjust for &best appearance", "[CLASS:Button; INSTANCE:2]")
Sleep(500)
ControlClick("[CLASS:#32770]", "Adjust for best &performance", "[CLASS:Button; INSTANCE:3]")
Sleep(500)
ControlClick("[CLASS:#32770]", "&Custom:", "[CLASS:Button; INSTANCE:4]")

For $x = 1 To 11
    For $a = 0 To ControlTreeView("[CLASS:#32770]", "Tree1", "[CLASS:SysTreeView32; INSTANCE:1]", "GetItemCount") + 1
        ControlTreeView("[CLASS:#32770]", "Tree1", "[CLASS:SysTreeView32; INSTANCE:1]", "Select", '#' & $a)
        ControlSend("[CLASS:#32770]", "Tree1", "[CLASS:SysTreeView32; INSTANCE:1]", '{space}')
    Next
Next
Link to comment
Share on other sites

  • 2 weeks later...

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