Jump to content
Sign in to follow this  
Icy

HotKeySet - how to UnSet?

Recommended Posts

Icy

HotKeySet("a","XX")
$C = 0

While 1 = 1
Sleep (5000)
WEnd

Func XX()
$C = $C + 1
If $C = 1 Then
While 1 = 1
Send ("cuss")
Sleep (1000)
WEnd
Else
$C = 0
EndIf
EndFunc

Hi. This is my simple function, which was supposed to start the function on the 1st key press and stop on the second press.

But it doesn't work well. Any help please?

Ps. use the most simple way to make my function work. =)

Thx

Edited by Icy

Share this post


Link to post
Share on other sites
water

Please check the help file for function HotKeySet, parameter 2:

"Not specifying this parameter will unset a previous hotkey."


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Icy

No nononono, I did check that and that's not what I need. I need to stop the function by pressing that key.

Share this post


Link to post
Share on other sites
water

But the title of this thread says "HotKeySet - how to UnSet?"


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Icy

No problem, I figured that out - some other way =)

Share this post


Link to post
Share on other sites
Icy

Awesome program btw!

Edit:

Although, if you could give me your solution for this, I would be happy. My is just improvised one...

Edited by Icy

Share this post


Link to post
Share on other sites
Shaarad

Maybe you can use a null parameter in the function itself so that next time it wont recognise that hotkey and serve the purpose. ;)


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.

Share this post


Link to post
Share on other sites
Icy

I noticed, that the function did loop forever because of the while 1=1 command. So I solved it with the IF function. Done and did it!

Share this post


Link to post
Share on other sites
water

This toggles key "a" to send/stop writing text.

HotKeySet("a", "XX")
HotKeySet("{ESC}", "_Exit")
$C = 0

While 1 = 1
    Sleep(5000)
WEnd

Func XX()
    HotKeySet("a", "YY")
    While 1 = 1
        IF $C = 0 Then
            Send("cuss")
            Sleep(1000)
        Else
            ExitLoop
        Endif
    WEnd
    $C = 0
EndFunc   ;==>XX

Func YY()
    $C = 1
    HotKeySet("a", "XX")
EndFunc   ;==>YY

Func _Exit()
    Exit
EndFunc

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
AdmiralAlkex

Or look at the TogglePause() function in the HotKeySet() example for how you can do it in one function instead of two (XX/YY).

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites
water

Thanks. That's even better and easier to understand ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Icy

Thanks for your help.

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  

×