Jump to content



Photo

Win7 apps resisting automation?


  • Please log in to reply
6 replies to this topic

#1 scotw

scotw

    Seeker

  • New Members
  • 3 posts

Posted 26 February 2012 - 11:39 AM

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.





#2 joelson

joelson

    Seeker

  • Active Members
  • 21 posts

Posted 26 February 2012 - 12:37 PM

maybe help...
ShellExecute(@SystemDir&"SystemPropertiesPerformance.exe")

for show window

but Windows Registry is best way

Edited by joelson, 26 February 2012 - 12:54 PM.


#3 scotw

scotw

    Seeker

  • New Members
  • 3 posts

Posted 26 February 2012 - 02:27 PM

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.

#4 joelson

joelson

    Seeker

  • Active Members
  • 21 posts

Posted 26 February 2012 - 03:52 PM

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, 26 February 2012 - 03:55 PM.


#5 dewcansam

dewcansam

    Seeker

  • New Members
  • 4 posts

Posted 26 February 2012 - 05:02 PM

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)


#6 danwilli

danwilli

    Unbalanced

  • Active Members
  • PipPipPipPipPipPip
  • 1,710 posts

Posted 26 February 2012 - 08:19 PM

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

AutoIt3/UDFs3 Online HelpUDF CollectionAutoIt SnippetsAutoIt 1-2-3 (For Learning)DllCallTCP Examples/Help------------------------------------------------------------Want a script written? Want to get paid to write one?Rent-A-Coder

#7 scotw

scotw

    Seeker

  • New Members
  • 3 posts

Posted 08 March 2012 - 04:16 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users