Sign in to follow this  
Followers 0
xzaz

Do one thing after 15 second the other

8 posts in this topic

Sorry for the wierd topic titel but didnt know how to explane it right: I got a exemple:

While 1
                Sleep("" & GUICtrlRead($wachten) & "")
                Send("" & GUICtrlRead($vraag) & "")
                If (BitAND(GUICtrlRead($check_2de), $GUI_CHECKED)) Then
                    Send("{ENTER}")
                    Send("" & GUICtrlRead($vraag2) & "")
                    
                Endif
                Send("{ENTER}")
                
                If(BitAND(GUICtrlRead($check_buzzer), $GUI_Checked)) Then
                    call ("buzzer")
                    Endif
                    
                    Wend
            

            EndFunc

The problem is: how can i activate de function buzzer every 15 seconds?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Use :

AdlibEnable()

Edit: Take a look at the help file for more details (if you are using Scite).

RK

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Share this post


Link to post
Share on other sites

Alright! Tnx for the replay, dindt know ther was a function to call a function at a pacific time. I got it like this now:

While 1
                            Sleep("" & GUICtrlRead($wachten) & "")
                            Send("" & GUICtrlRead($vraag) & "")
                            
                            If(BitAND(GUICtrlRead($check_buzzer), $GUI_Checked)) Then
                                AdlibEnable("buzzer",15000)
                                
                            Endif
                            
                            If (BitAND(GUICtrlRead($check_2de), $GUI_CHECKED)) Then
                                Send("{ENTER}")
                                Send("" & GUICtrlRead($vraag2) & "")
                                
                                
                            Endif
            
                            
                            Send("{ENTER}")

The problem now is that it wont do anithing. I tried a cupple of 'systems' to activate the function, should you alsow use AdlibDisable()?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This is NOT OK:

While 1
       If(BitAND(GUICtrlRead($check_buzzer), $GUI_Checked)) Then
           AdlibEnable("buzzer",15000)
       Endif
wend
oÝ÷ Ù·jëz÷«Êئ{*.ºÇvXvëazئzºÞ±ël¶¬Ü"YÞ½êÞÅç.µì¨¹û§rب.².ØZ½æ¢^j{Ú®&ëajÛZë¢{k¢ZÊ«~éܶ*')¶¬jëh×6
$buzzerIsChecked = false
AdlibEnable("buzzer",15000)

While 1
       If(BitAND(GUICtrlRead($check_buzzer), $GUI_Checked)) Then
           $buzzerIsChecked = true
       Endif
wend

func buzzer()
   if $buzzerIsChecked == false then return
    
   ;do your work here
endfunc

Note: There could be only one adlib running at the same time.

Edit: QA Stooge's alternative sounds good.

RK

Edited by rbhkamal

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Share this post


Link to post
Share on other sites

;) Its not working. I got this now:

; Start function
            func starten()
                Local $buzzTime = TimerInit()
                If(BitAND(GUICtrlRead($check_buzzer), $GUI_Checked)) Then
                    Tooltip("Test1",0,0) 
                Else 
                    ToolTip("Test2",0,0)
                EndIf
                
                        While 1
                            
                            Sleep("" & GUICtrlRead($wachten) & "")
                            Send("" & GUICtrlRead($vraag) & "")
                            
                            If (BitAND(GUICtrlRead($check_2de), $GUI_CHECKED)) Then
                                Send("{ENTER}")
                                Send("" & GUICtrlRead($vraag2) & "")
                                
                            Endif
                            
                            If(BitAND(GUICtrlRead($check_buzzer), $GUI_Checked)) Then
                              Tooltip("Test3",0,0) 
                                
                                    
                                    if Mod(TimerDiff($buzzTime), 1500) == 0 then
                                        Tooltip("Test4",0,0)
                                    call("buzzer")
                                    EndIF
                                    
                            EndIf
                                
                        Wend
            EndFunc

He is not comming in to the "Tooltip Test 4" Whats the roblem here. Im think i am looking to straight to it :whistle:

Share this post


Link to post
Share on other sites

Mod(TimerDiff($buzzTime), 1500)oÝ÷ Ø*.ÖÞjx¬²ç§ È ÜÛhrZ´Êv¬jëh×6                        If (TimerDiff($buzzTime) / 1000) >= 4 Then ;4 = 4 seconds
                            $buzzTime = TimerInit();Restart timer


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Lol tnx. I watched to it but let it go, dunno why :whistle:

This is it now and it works Tnx all!

func starten()
                Local $buzzTime = TimerInit()
                If(BitAND(GUICtrlRead($check_buzzer), $GUI_Checked)) Then
                    Tooltip("Test",0,0) 
                Else 
                    ToolTip("Test",0,0)
                EndIf
                
                        While 1
                            
                            Sleep("" & GUICtrlRead($wachten) & "")
                            Send("" & GUICtrlRead($vraag) & "")
                            
                        
                            If (BitAND(GUICtrlRead($check_2de), $GUI_CHECKED)) Then
                                Send("{ENTER}")
                                Send("" & GUICtrlRead($vraag2) & "")
                                
                            Endif
                            
                            If(BitAND(GUICtrlRead($check_buzzer), $GUI_Checked)) Then
                              Tooltip("Test",0,0) 
                                
                                    
                                    If (TimerDiff($buzzTime) / 1000) >= 16 Then ;4 = 4 seconds
                                        $buzzTime = TimerInit();Restart timer
                                    call("buzzer")
                                    EndIF
                                    
                                EndIf
                            
                            Send("{ENTER}")
                                
                        Wend
            EndFunc

Tnx, i think this is to difficult for me now.

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