Jump to content

Help creating simple run & click OK script


Go to solution Solved by mLipok,

Recommended Posts

Posted (edited)

Hi there,

For some reason that I have yet to uncover, my Windows visual settings don't display the swanky effects when minimizing / opening a new window. Everything else works.

The fix to this is to open the program "System Properties Performance" and to simply click the 'OK' button on the program.

I can get the code to run the program but I don't know what the script is to click OK on the program that it just opened. I've googled around but all the scripts I have found are long winded for other purposes, including background monitoring etc. 

So what I plan to do is add this script exe to the task scheduler (unless AutoIT ahs a built in launch-at-startup feature). I just need your help to write the part that will click the 'OK' button and close the program that it opens.

Thanks all!

Run ( "C:\Windows\System32\SystemPropertiesPerformance.exe" )
Edited by Sheza
Posted

Welcome to the forum:

for me works this:

Run('C:\Windows\System32\SystemPropertiesPerformance.exe')
WinWait('Opcje wydajności')
ControlClick('Opcje wydajności','','[TEXT:OK]')

mlipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Hi, thanks for getting back to me.

Unfortunately, the code doesn't seem to close / click OK after it loads the program.

EDIT: Realised it was a language issue. Got it working now, thanks so much.

EDIT2: I realised that it was a bit more complicated than clicking OK. If anyone else has this issue, this is the script that works for me (I blame Steam for this issue. When Steam opens, the effects stop working properly). Note that VisualEffects.exe is the name of the complied script EXE. For some reason it hangs around unless I tell it to close itself.

Run('C:\Windows\System32\SystemPropertiesPerformance.exe')
WinWait('Performance Options')
ControlClick("Performance Options", "", "[CLASS:Button; INSTANCE:2]")
ControlClick("Performance Options", "", "[CLASS:Button; INSTANCE:1]")
ControlClick("Performance Options", "", "[CLASS:Button; INSTANCE:5]")
ProcessClose ( "VisualEffects.exe" )
Edited by Sheza
Posted (edited)
 
  On 10/4/2013 at 6:09 PM, Sheza said:

Realised it was a language issue. Got it working now, thanks so much.

 

Seek and you shall find :)
A little sweat, and are the results :)

 

  On 10/4/2013 at 6:09 PM, Sheza said:

I realised that it was a bit more complicated than clicking OK. If anyone else has this issue, this is the script that works for me (I blame Steam for this issue. When Steam opens, the effects stop working properly). Note that VisualEffects.exe is the name of the complied script EXE. For some reason it hangs around unless I tell it to close itself.

 

Why not just do this:
Run('C:\Windows\System32\SystemPropertiesPerformance.exe')
WinWait('Performance Options')
ControlClick("Performance Options", "", "[Button1]")
ControlClick("Performance Options", "", "[TEXT:OK]")
ProcessClose("VisualEffects.exe")
If it does not work, carefully check the name of this Button.
Because maybe just a matter ;)
Edited by mlipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 10/4/2013 at 7:09 PM, Hodahel said:

Wow! maybe this is the answer for my long time problem!

Thanks!

Maybe it is! Do let me know! To avoid the program launching before Steam does, delay it 10 seconds in the task scheduler (or there may be an AutoIT way to delay it).

  On 10/4/2013 at 7:06 PM, mlipok said:

 

 

 

Seek and you shall find :)
A little sweat, and are the results :)

 

 

Why not just do this:
Run('C:\Windows\System32\SystemPropertiesPerformance.exe')
WinWait('Performance Options')
ControlClick("Performance Options", "", "[Button1]")
ControlClick("Performance Options", "", "[TEXT:OK]")
ProcessClose("VisualEffects.exe")
If it does not work, carefully check the name of this Button.
Because maybe just a matter ;)

 

The script needs to click onto one radio button, then back to the radio button that it was on, and then 'OK'. So I guess that script won't do it.

  • Solution
Posted
  On 10/4/2013 at 7:16 PM, Sheza said:

The script needs to click onto one radio button, then back to the radio button that it was on, and then 'OK'. So I guess that script won't do it.

 

aha, a misunderstanding:

Run('C:\Windows\System32\SystemPropertiesPerformance.exe')
WinWait('Performance Options')
ControlClick("Performance Options", "", "[Button2]")
ControlClick("Performance Options", "", "[Button1]")
ControlClick("Performance Options", "", "[TEXT:OK]")
ProcessClose("VisualEffects.exe")

continuing:
How is your progress with the click of the "OK" button?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 10/4/2013 at 7:37 PM, mlipok said:

 

aha, a misunderstanding:

Run('C:\Windows\System32\SystemPropertiesPerformance.exe')
WinWait('Performance Options')
ControlClick("Performance Options", "", "[Button2]")
ControlClick("Performance Options", "", "[Button1]")
ControlClick("Performance Options", "", "[TEXT:OK]")
ProcessClose("VisualEffects.exe")

continuing:
How is your progress with the click of the "OK" button?

 

My script already works fine - I guess yours is just a slightly shorter way or writing it?

Posted
  On 10/4/2013 at 7:41 PM, Sheza said:

I guess yours is just a slightly shorter way or writing it?

 

Not only that.
Think long view.
If in the future you will automate another program that changes frequently, you note that the keys OK OPEN SAVE CANCEL can change the number of times an instance, but rather not change the name.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 10/4/2013 at 7:55 PM, mlipok said:

 

Not only that.
Think long view.
If in the future you will automate another program that changes frequently, you note that the keys OK OPEN SAVE CANCEL can change the number of times an instance, but rather not change the name.

 

Ah I understand! Thanks for that. 

Posted

I forgot:

ProcessClose("VisualEffects.exe")

is unnecessary

just try

Exit

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

For some reason although I previously got it to work, it now isn't working properly. This script was working but now (even though I haven't changed anything!) it opens and closes the program without making the changes:

Run('C:\Windows\System32\SystemPropertiesPerformance.exe')
WinWait('Performance Options')
ControlClick("Performance Options", "", "[Button2]")
ControlClick("Performance Options", "", "[Button1]")
ControlClick("Performance Options", "", "[TEXT:OK]")
Exit

This one does work, but I haven't tried it at system start-up yet... will edit post....

Run('C:\Windows\System32\SystemPropertiesPerformance.exe')
WinWait('Performance Options')
ControlClick("Performance Options", "", "[CLASS:Button; INSTANCE:2]")
ControlClick("Performance Options", "", "[CLASS:Button; INSTANCE:1]")
ControlClick("Performance Options", "", "[CLASS:Button; INSTANCE:5]")
ProcessClose ( "VisualEffects.exe" )

EDIT: Well now I am confused! The script above worked when I just ran the script but now at Windows start-up it just opens the program, and closes it without clicking anything?!

The program .exe that is compiled on the above script just worked but I had to open it manually, it does not work when it opens automatically at start-up, why?

EDIT2: Have tinkered with Event Scheduler and may have a sort of fix. Will see later...

Edited by Sheza
Posted

I was blind,

Run('C:\Windows\System32\SystemPropertiesPerformance.exe')
WinWait('Performance Options')
ControlClick("Performance Options", "", "Button2")
ControlClick("Performance Options", "", "Button1")
ControlClick("Performance Options", "", "[TEXT:OK]")
Exit

"Button2" not "[button2]"

Again would be a shame.

I think I need a rest  :bye:

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 5 years later...
Posted

I tried to do it this way, but it didn't work. I changed my script to use buttons' ID (checked in autoit window info):

Run("C:\Windows\System32\SystemPropertiesPerformance.exe")
WinWaitActive("Performance Options")
ControlClick("Performance Options", "", 2023)
ControlClick("Performance Options", "", 2022)
ControlClick("Performance Options", "", 2023)
ControlClick("Performance Options", "", 1)

but it also doesn't work. My system is Windows 10 Pro. Any ideas?

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
  • Recently Browsing   0 members

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