Jump to content

Stopping countdown with a button?


kaiks
 Share

Recommended Posts

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? :)

Link to comment
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
Link to comment
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
Link to comment
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...

Edited by kaiks
Link to comment
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
Link to comment
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?

Link to comment
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
 Share

  • Recently Browsing   0 members

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