Jump to content
Sign in to follow this  
scotw

Win7 apps resisting automation?

Recommended Posts

scotw

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.

Share this post


Link to post
Share on other sites
joelson

maybe help...

ShellExecute(@SystemDir&"SystemPropertiesPerformance.exe")

for show window

but Windows Registry is best way

Edited by joelson

Share this post


Link to post
Share on other sites
scotw

Thanks, I can get the app to launch just fine, just not respond to autoit once it has. :)

I had hoped to avoid registry changes for this, but may resort to that.

Share this post


Link to post
Share on other sites
joelson

language my windows is português, you need change for your language

ShellExecute(@SystemDir&"SystemPropertiesPerformance.exe")
WinWait("Opções de Desempenho")
$ID=ControlGetHandle('Opções de Desempenho',"","[CLASS:Button; INSTANCE:3]")
ControlCommand('',"",$ID,"Check")
Edited by joelson

Share this post


Link to post
Share on other sites
dewcansam

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)

Share this post


Link to post
Share on other sites
DW1

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

Share this post


Link to post
Share on other sites
scotw

Thank you so much, #RequireAdmin was the answer ! :oops:

Share this post


Link to post
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
Sign in to follow this  

×