Sign in to follow this  
Followers 0
Guest nosfera2

Pausing until a specifc button is clicked

7 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



Might try something like the following:

While Not ControlCommand ("Virtual Memory", "", "1165", "IsEnabled", "") 
    Sleep ( 100 )
Wend

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#4 ·  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.

Share this post


Link to post
Share on other sites

#5 ·  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

Share this post


Link to post
Share on other sites

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



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

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

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  
Followers 0