 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
smikkelsen
Joined: 24 Jun 2008 Posts: 104
|
Posted: Wed Aug 12, 2009 3:07 am Post subject: Exit / kill thread problem |
|
|
I have a subroutine that runs, and in the subroutine it has a function call that is called from an external library. That function loops until I hit a specific key, then it returns to my original subroutine to contine. I would like to make a second subroutine that would exit or kill the loop in the external function without pressing the designated key to make it contine.
Here is some code so you can understand what I mean:
| Code: |
sub:
{
loop,
{
wait("Ctrl") ; this calls the external function and waits until the Ctrl button is pressed
some code to do something
}
}
|
Here is my function that i'm using:
| Code: |
wait(passbutton)
{
clipboard=
while state<>"D"
{
GetKeyState, state, %passbutton%,P
mousegetpos,lx,ly
lx := lx+20
ly := ly-20
ToolTip, Press %passbutton%, %lx%, %ly%,
}
ToolTip
}
|
I would like a second subroutine to kill the previous function and/or subroutine. Something like this:
This of course only kills the current thread, but the external function continues to loop/wait until the Ctrl button is pressed.
Anyone know how I can accomplish this? _________________ “Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”
-Dwight |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Wed Aug 12, 2009 9:23 am Post subject: |
|
|
why not make another version of the function that doesn't need the keypress?
send it a time or something. _________________
(Common Answers) |
|
| Back to top |
|
 |
smikkelsen
Joined: 24 Jun 2008 Posts: 104
|
Posted: Wed Aug 12, 2009 7:33 pm Post subject: |
|
|
This is for a sort of html editor. What it does is I click a button on a gui to start the subroutine, and it waits until I click a key to continue. The reason I need this is because the subroutine will wait until I highlight the text that I am trying to format, and click the Ctrl button. At that point, it will copy the text, and add the correct html tags at the beginning and end of the text, then paste it. So a timer wouldn't work. I would either have to wait for it, or rush to highlight the correct text before it screws things up.
Here is the entire subroutine if it helps:
| Code: |
bullet:
{
guicontrol, Hide, • Bullets
guicontrol, Show, • Bullets Off
loop,
{
wait("Ctrl")
sleep, 200
send, {ctrl down}c{ctrl up}
clipwait
text=%clipboard%
clipboard=<li>%text%</li>
send, {ctrl down}v{ctrl up}
sleep, 400
}
return
}
|
_________________ “Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”
-Dwight |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Thu Aug 13, 2009 7:41 am Post subject: |
|
|
so the request is for some kind of cancel command? _________________
(Common Answers) |
|
| 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
|