Jump to content

hotkey


oMBRa
 Share

Recommended Posts

here is an exmaple ;)

HotKeySet("x", "OMG")

While 1
Wend

Func OMG()
MsgBox(0, "Working", "HotkeyFunction is Working ")
endfunc

so when you press "X" it will open the function ^^

Edited by Cha0sBG

Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ยน There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.

Link to comment
Share on other sites

How would that even work? Every time you type "Hello" your function would activate? What if you were trying to type up a document?

Anyway, there's no easy way to do something like that, you'll have to devise your own method of doing it with functions like _IsPressed().

*Edit: Or check this out, someone already did this: http://www.autoitscript.com/forum/index.ph...mp;hl=hotstring

Edited by RobSaunders
Link to comment
Share on other sites

  • Moderators

Guess you could always get creative if you didn't want to hook the keyboard:

Global $s_hello_last_key
HotKeySet("h", "_Hello")

While 1
    Sleep(10000)
WEnd

Func _Hello()
    Local $f_move_next = False
    Local $s_key = @HotKeyPressed
    If $s_key = "l" And $s_key = $s_hello_last_key Then $f_move_next = True ;double l
    Switch $s_key
        Case "h"
            HotKeySet("e", "_Hello")
        Case "e"
            If $s_hello_last_key <> "h" Then
                HotKeySet("h", "_Hello")
            Else
                HotKeySet("l", "_Hello")
            EndIf
        Case "l"
            If $f_move_next Then
                HotKeySet("o", "_Hello")
            ElseIf $s_hello_last_key <> "e" Then
                HotKeySet("h", "_Hello")
            EndIf
        Case "o"
            If $s_hello_last_key = "l" Then MsgBox(64, "Info", "You typed hello")
            HotKeySet("h", "_Hello")
    EndSwitch
    $s_hello_last_key = $s_key
EndFunc

Edited by SmOke_N

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.

Link to comment
Share on other sites

SmOke_N with yuor scripts I will cant use the words h e l l o and with manadar udf i get always " C:\Documents and Settings\Fabry\Desktop\autoit scripts\Example.au3 (3) : ==> Error opening the file.: #include <HotString.au3>"

but the file are in the same directory

Link to comment
Share on other sites

SmOke_N with yuor scripts I will cant use the words h e l l o and with manadar udf i get always " C:\Documents and Settings\Fabry\Desktop\autoit scripts\Example.au3 (3) : ==> Error opening the file.: #include <HotString.au3>"

but the file are in the same directory

I uploaded HotString.au3

When the words fail... music speaks.

Link to comment
Share on other sites

  • Moderators

SmOke_N with yuor scripts I will cant use the words h e l l o.

Well... no kidding, I didn't write exceptions for spaces, that's up to you. I only gave a working example of how it could be done without hooking anything.

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.

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...