Sign in to follow this  
Followers 0
Joshuaaaa

Whats wrong with this code?

4 posts in this topic

#1 ·  Posted (edited)

I am able to run this code with no errors, but for some reason the last bit of the code right here:

If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then
Send("{F1 Down}")
Sleep(6000); 60 seconds
Send("{F1 Up}")
               EndIF

It's not working. It does not give me any error messages, but it is not effective. What I'm trying to do is have it press F1 (an in-game hotkey) every 60 seconds. But it's not... I've been trying to figure this out for 2 days, no joke. Anybody help me? Below is the full code.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Run
            If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then
 Send("{LCTRL Down}")
Sleep(0); 0 seconds
Send("{LCTRL Up}")
                EndIf
            If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) Then
                 Do
     MouseClick ("SECONDARY") 
     Sleep(1); 1= .01sec
 Until _IsPressed ("09")
          EndIf
If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then
Send("{F1 Down}")
Sleep(6000); 60 seconds
Send("{F1 Up}")
               EndIF
                    EndSwitch
            Wend
Edited by Joshuaaaa

Share this post


Link to post
Share on other sites



Sleep(0); 0 seconds

Sleep uses millionsecond as its unit, you still need to go AutoIt Option to change SendKeyDelay, but technically you cannot make the time 0 ms. Some function will have to take place which it takes time.

Sleep(6000); 60 seconds

60 seconds is Sleep(60 * 1000)

Share this post


Link to post
Share on other sites

i see. hmm... how could i have it so that if checkbox2 is checked, then checkbox1 is made unclickable? don't mean to bug.. i've tried so many times.

Share this post


Link to post
Share on other sites

If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then GUICtrlSetState($Checkbox1, $GUI_DISABLE)

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