Xenobiologist Posted May 5, 2006 Share Posted May 5, 2006 (edited) Hi, I don't know whether this is the right place to put such an easy script, but maybe some people need something like that one day. A friend of mine asked me, how to use one hotkey to call different funcs by hitting the key different times. (The func put() is just to show, that different funcs are called. ) So here it is: HotKeySet("a", "pressed") Dim $i = 0, $PushTime = 1000 While 1 Sleep(100) WEnd Func pressed() $i += 1 Sleep($PushTime) Switch $i Case 1 put(1) Case 2 put(2) Case 3 put(3) Case 4 Exit (0) EndSwitch $i = 0 EndFunc ;==>pressed Func put($y) MsgBox(0, "Func called: ", "Nr: " & $y) EndFunc ;==>put So long, Mega Edited July 13, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Valuater Posted May 5, 2006 Share Posted May 5, 2006 Actually i didn't understand at first... i would press ( slowly) and kep getting a message box with "1" but, then i realized you press the key 1 to 4 times within the $PushTime/sleep and the function is called with the corresponding # of 1 to 3... 4 exits I have never used hotkeyset() like this Good demo.... th.meger 8) Link to comment Share on other sites More sharing options...
RazerM Posted May 5, 2006 Share Posted May 5, 2006 same here valuater. Interesting use of hotkeyset. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
slightly_abnormal Posted May 5, 2006 Share Posted May 5, 2006 same here valuater. Interesting use of hotkeyset.yeah.. cool. Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 5, 2006 Author Share Posted May 5, 2006 Hi, thanks. It was kind of crackbrained. Firstly, I thought I have to take the time between hitting the hotkey but then I tried to create the buffer with the sleep command and it worked. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
JSThePatriot Posted May 5, 2006 Share Posted May 5, 2006 Shows another way of thinking outside the box. I was like "hrm how is he going to accomplish this"...once I saw the variable $PushTime and its location in the Sleep I knew it was the amount of times pressed. I like it. I think it could be a useful script. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 5, 2006 Author Share Posted May 5, 2006 (edited) Hi, that's so crazy. I tried to create some useful scripts like (see my sig) and I think there might be some people out there who uses them. But no SmOke_N, garfrost, Valuater, BigDod, JSThePatriot and so on replied. But posting this little script ... Nevertheless, I'll keep on running. I love this forum! So long, Mega Edited May 5, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
JSThePatriot Posted May 6, 2006 Share Posted May 6, 2006 Hi,that's so crazy. I tried to create some useful scripts like (see my sig) and I think there might be some people out there who uses them. But no SmOke_N, garfrost, Valuater, BigDod, JSThePatriot and so on replied. But posting this little script ... Nevertheless, I'll keep on running. I love this forum! So long,MegaI am in and out of the forums...many of your programs look good. I dont always have the time to check them out. I do appreciate the value you place on my opinion.Lata,JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Cue Posted September 29, 2006 Share Posted September 29, 2006 (edited) Is this not a better way of doing it. this way you will not have to wait 1 second if you only pressed it once and you can keep going for as many presses as you like. HotKeySet("a", "pressed") Dim $i = 0, $PushTime = 200 While 1 Sleep(100) WEnd Func pressed() $i += 1 Do $g=$i Sleep($PushTime) Until $g==$i Switch $i Case 1 put(1) Case 2 put(2) Case 3 put(3) Case 4 Exit (0) EndSwitch $i = 0 EndFunc Func put($y) MsgBox(0, "Func called: ", "Nr: " & $y) EndFunc Edited September 29, 2006 by Cue Link to comment Share on other sites More sharing options...
RazerM Posted September 30, 2006 Share Posted September 30, 2006 That works brilliantly Cue! It is much better without the wait My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Xenobiologist Posted September 30, 2006 Author Share Posted September 30, 2006 That works brilliantly Cue! It is much better without the wait Hi, what is better at the func from Cue? Nice idea, but I still like my demo expandcollapse popupHotKeySet("1", "pressed") HotKeySet("2", "pressed1") Dim $i = 0, $PushTime = 1000, $begin = 0 While 1 Sleep(100) WEnd Func pressed() $begin = TimerInit() $i += 1 Do $g = $i Sleep($PushTime) Until $g == $i Switch $i Case 1 put(1) Case 2 put(2) Case 3 put(3) Case 4 Exit (0) EndSwitch $i = 0 EndFunc ;==>pressed Func pressed1() $begin = TimerInit() $i += 1 Sleep($PushTime) Switch $i Case 1 put1(1) Case 2 put1(2) Case 3 put1(3) Case 4 Exit (0) EndSwitch $i = 0 EndFunc ;==>pressed1 Func put($y) ConsoleWrite("Nr: " & $y & " Cue : " & Round(TimerDiff($begin), 4) & @LF) ;MsgBox(0, "Func called: ", "Nr: " & $y) EndFunc ;==>put Func put1($y) ConsoleWrite("Nr: " & $y & " Mega: " & Round(TimerDiff($begin), 4) & @LF) ;MsgBox(0, "Func called: ", "Nr: " & $y) EndFunc ;==>put1 So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
RazerM Posted September 30, 2006 Share Posted September 30, 2006 When i tested them together Cues worked better because if i pressed the hotkey 3 times fastly it would always pop up saying "you pressed 3 times" but yours would sometimes say "you pressed 2 times" then "you pressed 1 times" My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Xenobiologist Posted September 30, 2006 Author Share Posted September 30, 2006 When i tested them together Cues worked better because if i pressed the hotkey 3 times fastly it would always pop up saying "you pressed 3 times" but yours would sometimes say "you pressed 2 times" then "you pressed 1 times"Hi,I see, no problem for me there. Both worked fine.So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Cue Posted September 30, 2006 Share Posted September 30, 2006 (edited) Thanks RazerM. th.meger i did not mean to say that your function is written badly but i thought it would just be better to wait for a certain time between consecutive keys than wait 1 second for any amount of keypresses. why did you write code to compare the two? Edit: [ Your code for comparing the two will always give the same or a longer time for pressed() since you have used $PushTime with a value of 1000 for both functions] Edit: [mistake on last edit] Edited October 4, 2006 by Cue Link to comment Share on other sites More sharing options...
icadea Posted March 2, 2008 Share Posted March 2, 2008 thanks. this is great. I could make software for disabled people using this code. thanks Cue 1 Link to comment Share on other sites More sharing options...
WolfWorld Posted March 2, 2008 Share Posted March 2, 2008 This is not just n easy script but it also show us that if hotkey call a function and the function is not finish and hotkey is pressed again it will exit the last function and start the new function Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
James Posted March 2, 2008 Share Posted March 2, 2008 Woah, someone brought up a two year old topic, brill! ¬_¬ Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Achilles Posted March 2, 2008 Share Posted March 2, 2008 Nice work... it's original, even though it was two years ago, I didn't realize that... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
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