oMBRa Posted August 20, 2008 Posted August 20, 2008 How to use a word like an hotkey? if I use HotKeySet("hello", "MyFunction") the function will be called when I press H or E etc... so how to do it?
Cha0sBG Posted August 20, 2008 Posted August 20, 2008 (edited) 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 August 20, 2008 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.
oMBRa Posted August 20, 2008 Author Posted August 20, 2008 the hotkey must be a word not a char... word like "hello"
therks Posted August 20, 2008 Posted August 20, 2008 (edited) 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 August 20, 2008 by RobSaunders My AutoIt Stuff | My Github
Moderators SmOke_N Posted August 20, 2008 Moderators Posted August 20, 2008 (edited) 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 August 20, 2008 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.
oMBRa Posted August 20, 2008 Author Posted August 20, 2008 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
Andreik Posted August 20, 2008 Posted August 20, 2008 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 directoryI uploaded HotString.au3
Moderators SmOke_N Posted August 21, 2008 Moderators Posted August 21, 2008 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now