Jump to content

Pausing until a specifc button is clicked


Recommended Posts

Guest nosfera2
Posted (edited)

Evening folks,

I want a script to pause until a specific button is pressed. Having done some research I discovered I need to write a loop that exits when said button is clicked. I also need to use the ControlCommand function.

So far I have this -> ControlCommand ("Virtual Memory", "", "1165", "IsEnabled", "") pathetic I know, but how do I wrap this into a loop and is this right at all?

TIA

Edited by nosfera2
Guest nosfera2
Posted

Hi gafrost,

Thanks for the input. I tried your suggestion, but the script does not pause there, I think because the button is enabled ie the script can see it so continues running.

I tried:

While Not ControlClick ("Virtual Memory", "", "Button2")

Sleep ( 50000 )

Wend

as a sort of "whilst the button isn't clicked wait here" but that did not work either.

I also gave the following a go:

Do

Sleep(100)

Until ControlCommand ( "Virtual Memory", "", "Button2", "IsEnabled", "")

but that didn't do the trick.

Is there an "on click" function, or any other suggestions?

Cheers

  • Moderators
Posted (edited)

$Enabled = ControlCommand ( "Virtual Memory", "", "Button2", "IsEnabled", "")

Do

Sleep(100)

Until $Enabled <> 0

Question

Does the Control ever not exist?

When the Control is clicked what happens?

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Guest nosfera2
Posted (edited)

Hi,

No, the control will always exist.

Nothing happens once the "set" button (the control in question) is clicked. Exiting out of the "System Properties" does prompt for a reboot, but otherwise nothing else happens.

For background info I am trying to automate setting virtual memory on NT4 PC's I rebuild.

Here's the script so far:

Run('control sysdm.cpl')

WinWait("System Properties","")

If Not WinActive("System Properties","") Then WinActivate("System Properties","")

WinWaitActive("System Properties","")

Send("{RIGHT}{ALTDOWN}c{ALTUP}")

WinWait("Virtual Memory","")

If Not WinActive("Virtual Memory","") Then WinActivate("Virtual Memory","")

WinWaitActive("Virtual Memory","")

Send("{TAB}")

here I want to manually fill in values for the minimum and maximum virtual memory, click on "set" and then exit out of the system properties.

Edited by nosfera2
Posted

Could you not have Input boxes prompt you for the values and pass them to the required fields.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Guest nosfera2
Posted

Yes BigDod, I was thinking of something similar if I could not get an "on click" loop constructed.

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