Jump to content

Whats wrong with this code?


 Share

Recommended Posts

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
Link to comment
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)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...