Jump to content
Sign in to follow this  
zzxxzzxx

Just new & need quidance

Recommended Posts

http://www.autoitscript.com/forum/index.php?showtopic=5760

very new here. so hope anyone can show me some skills to these few functions. :)

1. pressing F9 will toggle LEFT CLICK hold DOWN

2. pressing F10 will toggle RIGHT CLICK hold DOWN

3. pressing F11 will toggle pressing SPACEBAR in loop with 1 sec delay?

4. pressing F12 will stop the above 3

5. pressing F8 will exit program

maybe some GUI to show these functions too :( if possible.

its actually for a game Mu Online, but i would like to know how to do these stuffs based on the IsPressed function above (link).

i want to start learning by looking at how its done for the above. :( hope someone can help. it's easier to learn from something that interests you. :

Share this post


Link to post
Share on other sites

HotKeySet most likely, and just set a variable to 1 or 0 based upon whether the button is currently down or not..

i.e.

If pressing F9 through my function Then

Stop pressing F9

set $F9isdown to 0

Else

Start pressing F9

set $F9isdown to 1

EndIf


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Just what you asked for.......

#include <GUIConstants.au3>

$Window=GUICreate("My GUI")


Global $Left="", $Right="", $Space=""

$Send=GUICtrlCreatelabel("1. pressing F9 will toggle LEFT CLICK hold DOWN " & @CRLF & _
"2. pressing F10 will toggle RIGHT CLICK hold DOWN"& @CRLF & _
"3. pressing F11 will toggle pressing SPACEBAR in loop with 1 sec delay" & @CRLF & _
"4. pressing F2 will stop the above 3 (note F12 would not work for me)" & @CRLF & _
"5. pressing F8 will exit program", 30, 30, 350, 350)

;Windows prohibits ESC, ENTER, TAB, SPACEBAR, PRINT SCREEN, SHIFT, or BACKSPACE from being used in hotkeys.
; soooo... i put it in the while 1 loop

HotKeySet("{F8}", "_Exit")
HotKeySet("{F9}", "_Left")
HotKeySet("{F10}", "_right")
HotKeySet("{F11}", "_Space")  
HotKeySet("{F2}", "_Clear")

GuiSetState()


  


While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE then 
        MsgBox(0, "Close GUI", "This will close the GUI   "  & @CRLF & " to Exit the program press *F8*   ")
        GUISetState(@SW_HIDE, $Window)
    EndIf
    
    If $Space <> "" then 
        Send("{SPACE}")
        Sleep(990)
    EndIf
    
    Sleep(10)
WEnd

;---------- functions -------------------

Func _Exit()
    ToolTip('Exiting the program',0,0)
    Sleep(1000)
    ToolTip("")
    Exit 0
EndFunc

Func _Left()
    If $left = "" then 
        MouseDown("left")
        $Left="Down"
        ToolTip('Mouse is Left Clicked Hold',0,0)
        Sleep(1000)
        ToolTip("")
        Return
    EndIf
    If $left <> "" then 
        MouseUp("left")
        $Left=""
        ToolTip('Mouse is Left Click Off',0,0)
        Sleep(1000)
        ToolTip("")
        Return
    EndIf
EndFunc

Func _Right()
    If $Right = "" then 
        MouseDown("right")
        $Right="Down"
        ToolTip('Mouse is Right Clicked Hold',0,0)
        Sleep(1000)
        ToolTip("")
        Return
    EndIf
    If $Right <> "" then 
        MouseUp("right")
        $Right=""
        ToolTip('Mouse is Right Click Off',0,0)
        Sleep(1000)
        ToolTip("")
        Return
    EndIf
EndFunc

Func _Space()
    If $Space = "" then 
        $Space="Down"
        ToolTip('Space will be pressed every one second +/-',0,0)
        Sleep(1000)
        ToolTip("")
        Return
    EndIf
    If $Space <> "" then 
        $Space=""
        ToolTip('Space will not be pressed',0,0)
        Sleep(1000)
        ToolTip("")
        Return
    EndIf
EndFunc

Func _Clear()
; F12 key does not work on my system ;MsgBox(0, "Close GUI", "Working................")
    
    MouseUp("right")
    $Right=""
    ToolTip('Mouse is Right Click Off',0,0)
    Sleep(1000)
    ToolTip("")
    
    MouseUp("left")
    $Left=""
    ToolTip('Mouse is Left Click Off',0,0)
    Sleep(1000)
    ToolTip("") 
    
    $Space=""
    ToolTip('Space will not be pressed',0,0)
    Sleep(1000)
    ToolTip("")
    
EndFunc

F12 would not work on my system... changed to F2

and

;Windows prohibits ESC, ENTER, TAB, SPACEBAR, PRINT SCREEN, SHIFT, or BACKSPACE from being used in hotkeys.

; soooo... i put it in the while 1 loop

Tweak how you want........ Enjoy! 8)


NEWHeader1.png

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...