 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
CannedCheese
Joined: 21 May 2008 Posts: 85
|
Posted: Fri Aug 22, 2008 1:23 am Post subject: Simple Question Re: GUI Buttons Interrupting Functions... |
|
|
I think this is simple but I can find some code and post it if necessary.
I'll often trigger a function call when a gui button is pressed. Once the function is launched, the gui stops responding [i.e., you can press buttons but they won't launch their subroutines] until the function is terminated/returns, and any additional button presses aren't cached-- they're simply lost forever.
I'm sure that this comes up often but I'm not sure what to search for.
What if I wanted to launch a function with a gui button press, and have a different button-- a pause button (or reload), or whatever other button call a function and interrupt the currently executing function? Since I'm using functions instead of subroutines (does it make a difference?), I'm not sure I can use a timer to send a routine if a button has been pressed while a function is running.
Sorry if this is confusing, I'm wrapping up a long day. I'll try to clean this up later. |
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 711 Location: Calgary, AB, Canada
|
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 666 Location: MN, USA
|
Posted: Fri Aug 22, 2008 3:24 pm Post subject: |
|
|
This works for me. | Code: | #SingleInstance force
#NoEnv
Gui, Add, Button, gFunct, Function
Gui, Add, Button, gPause, Pause
Gui, Show
return
GuiClose:
ExitApp
Funct:
Function()
MsgBox,Function finished.
return
Pause:
Pause,,1
return
Function()
{
Sleep, 5000
} |
_________________ http://autohotkey.net/~jaco0646/ |
|
| Back to top |
|
 |
CannedCheese
Joined: 21 May 2008 Posts: 85
|
Posted: Tue Aug 26, 2008 4:36 pm Post subject: |
|
|
| Sorry for the slow response, but I’ve been out of town the last few days. I’ve created some sample scripts and they seem to work fine, so I’m wondering if my problems stem from the fact that the functions that I am calling have high cpu utilization as they are Imagesearch functions (and setbatchlines is set to -1 within those functions). Its almost as if the gui buttons are buffered when clicked but never executed (well, sometimes they work, sometimes they don’t, but you may have to hit the buttons quite a few times). I can’t post the entire code, but I will try to recreate the issue with imagesearch on some non-proprietary software and post it. Appreciate the feedback, and the other thread seems like it may be relevant as well. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|