Jump to content

Tell if a button is pressed?


Recommended Posts

While $vDelay > 0 AND $Continue = 1
                     $vDelay = $vDelay - 100
                     Sleep(100)
                  WEnd

Is inside a function I made, which should allow commands to still be sent to the GUI right?

The entire GUI is rendered useless in this state. No buttons can be used at all, I don't know much about the GUI and I can't find anything else that can help me in the help file.

I tried searching for 'recieve message while sleeping' as I thought that may be the problem... no results really.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to post
Share on other sites

i think i know what ur talking about... heres an example

#include <GUIConstants.au3>
GUICreate ("Test")
$button= GUICtrlCreateButton ("Test", 20, 20)
GUISetState ()
While 1
$get= GUIGetMsg ()
Select
Case $get= $button
MsgBox (0, "You just...", "You just hit this button")
Case $get= $GUI_EVENT_CLOSE;or -3
   Exit
Endselect
Wend

i had the same problem when i was new, just try that and hit the button and study the code!

bye!

is that what ur looking for?

Edited by layer
FootbaG
Link to post
Share on other sites

Didn't fix it.

Hotkeys work fine... :idiot:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to post
Share on other sites

While $vDelay > 0 AND $Continue = 1
                     $vDelay = $vDelay - 100
                     Sleep(100)
                  WEnd

Is inside a function I made, which should allow commands to still be sent to the GUI right?

Probably not. Consider the following example:

Opt("TrayIconDebug", 1)
#include <GUIConstants.au3>
GUICreate ("Test")
$button= GUICtrlCreateButton ("Test", 20, 20)
GUISetState ()
While 1
   $get= GUIGetMsg()
   Select
   Case $get= $button
      Foo()
      MsgBox(4096,"Notify", "You clicked the button")
   Case $get= $GUI_EVENT_CLOSE
      ExitLoop
   Endselect
Wend
Exit

Func Foo()
   While 1
      sleep(10)
   WEnd
EndFunc

If you hover your mouse over the tray icon, you will notice that the program spends most of its time on Line 7: $get = GuiGetMsg(). However, after clicking the button, the program gets stuck in function Foo. Since GuiGetMsg is no longer being processed, the GUI will not respond to any events until you break out of that loop....

Hope that helps

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to post
Share on other sites

I tried it inside the while loop, like so:

While $vDelay > 0 AND $Continue = 1
                     $Get= GUIGetMsg()
                     
                     If $Get = $End Then
                        _Stop()
                     EndIf
                     
                     $vDelay = $vDelay - 100
                     Sleep(100)
                  WEnd 


;Function:
Func _Stop()
   $Continue = 0
   _MsgBox(1,"iSpam stopped!", "Sucessfully stopped.")
EndFunc

Is that what you meant? (didn't work either)

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to post
Share on other sites

I had that problem. Do you think it'd be possible to use AdlibEnable? For example:

AdlibEnable("myadlib", "100")

Your code

Func myadlib()

$vDelay = $vDelay - 100

EndFunc

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to post
Share on other sites

Ah, that just might be possible, great idea

I'll try it when I'm not about to flop over and die from lack of sleep :idiot:

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...