Sign in to follow this  
Followers 0
kaiks

Stopping countdown with a button?

7 posts in this topic

Uh, yes, I want to exit 'countdown' loop once the button is pressed, but I can't get it to work.

I'm not interested in using 'Exit', using for example...

Func dosomething()
While $aaa=1
;do anything
WEnd
EndFunc
Func Buttonpressed()
$aaa=2
EndFunc

...didn't work for me too.

any ideas? :)

Share this post


Link to post
Share on other sites



Uh, yes, I want to exit 'countdown' loop once the button is pressed, but I can't get it to work.

I'm not interested in using 'Exit', using for example...

Func dosomething()
While $aaa=1
;do anything
WEnd
EndFunc
Func Buttonpressed()
$aaa=2
EndFunc

...didn't work for me too.

any ideas? :)

Read the help file for HotKeySet(). For example to run your Buttonpressed() function when ESC is pressed:

HotKeySet("{ESC}", "Buttonpressed")

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

With button, not hotkey

Thanks for a try tho

Edited by kaiks

Share this post


Link to post
Share on other sites

With button, not hotkey

Thanks for a try tho

Oh. Then read the help file on GuiCreate() and GuiCtrlCreateButton().

The examples there are pretty straight forward. For best results use the "Event Mode" for your GUI.

Cheers!

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

If I got 5posts, it doesn't mean that I don't know anything about autoit, I know basics.

I wouldn't ask for a help with events on buttons if I wouldn't be able to create simple GUI and events in autoit.

My problem is that while loop in this functions doesn't let other loop look for button messages...

Edited by kaiks

Share this post


Link to post
Share on other sites

If I got 5posts, it doesn't mean that I don't know anything about autoit, I know basics.

I wouldn't ask for a help with buttons of events if I wouldn't be able to create simple GUI and events in autoit.

My problem is that while loop in this functions doesn't let other loop look for button messages...

You misunderstand "Event Mode". First you create the GUI with GuiCreate(), then add the button with GuiCtrlCreateButton(), remembering to save the control ID. Sounds like you feel comfortable with it that far.

Now instead of a While loop reading GuiGetMsg(), use the GuiCtrlSetOnEvent() function to define the function you want run when the button is pushed. Your script can go on to do whatever else you like and will be interrupted to run the selected function when the button is pushed.

Give it a shot with short demo script, and post the code you've got if it doesn't work.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

If I got 5posts, it doesn't mean that I don't know anything about autoit, I know basics.

I wouldn't ask for a help with events on buttons if I wouldn't be able to create simple GUI and events in autoit.

My problem is that while loop in this functions doesn't let other loop look for button messages...

Well, while you're right that post count does not affect or show your knowledge of the program, we can not read your mind and are like tech support except more helpful, we can't just assume where you are experience wise, so we start easy and move up, the reason you're code isn't working (assuming of course that that is your whole code) because it is all in functions, and no part of the script is calling the functions to run

How are we supposed to know what you want?

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