Sign in to follow this  
Followers 0
alfa

making multiple clicks with different hotkeys.

4 posts in this topic

 Hi,

I am trying to make autoit press different keys with different hotkeys.

With this scripts that i made with my limited knowledge it stops the previous key from being send. I want them both being pressed.

Thanks in advance to point out my mistakes :)

Global $UnPaused1
Global $UnPaused2
HotKeySet("{F1}", "TogglePause1")
HotKeySet("{F2}", "TogglePause2")
HotKeySet( "{PGDN}", "Terminate" )

While 1
    Sleep(100)
    ToolTip("Script is Paused",0,0)
WEnd

Func TogglePause1()
    $UnPaused1 = NOT $UnPaused1
    While $UnPaused1
;~         ToolTip("Sending...",0,0)
        Send("3")
        Sleep (150)
    WEnd
EndFunc

Func TogglePause2()
    $UnPaused2 = NOT $UnPaused2
    While $UnPaused2
;~         ToolTip("Sending...",0,0)
        Send("4")
        Sleep (100)
    WEnd
EndFunc

Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
Share on other sites



Func TogglePause1()
    HotKeySet("{F1}")
    Send("{F1}")
    HotKeySet("{F1}", "TogglePause1")
    $UnPaused1 = NOT $UnPaused1
    While $UnPaused1
;~         ToolTip("Sending...",0,0)
        Send("3")
        Sleep (150)
    WEnd
EndFunc


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Func TogglePause1()
    HotKeySet("{F1}")
    Send("{F1}")
    HotKeySet("{F1}", "TogglePause1")
    $UnPaused1 = NOT $UnPaused1
    While $UnPaused1
;~         ToolTip("Sending...",0,0)
        Send("3")
        Sleep (150)
    WEnd
EndFunc

it didnt work :( Thanks anyway.

Well this code worked but it still stoped the second key.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I suggest you to set just the value of a variable with HotKeySet and left the work to main loop:

[pseudocode]

Global $var1, $var2
HotKeySet("{F1}", "TogglePause1")
HotKeySet("{F2}", "TogglePause2")
HotKeySet( "{PGDN}", "Terminate" )

While 1
    Sleep(100)
    ToolTip("Script is Paused",0,0)
    If $var1 == value1 Then
        While something
            ;do things
            If $var2 == value2 Then Exitloop
        Wend
    EndIf
    If $var2 == value2 Then
        While something
            ;do things
            If $var1 == value1 Then Exitloop
        Wend
    EndIf
WEnd

Func TogglePause1()
    $var1 = value1
EndFunc

Func TogglePause2()
    $var2 = value2
EndFunc

Func Terminate()
    Exit 0
EndFunc
Edited by j0kky

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