JimmyN Posted October 23, 2014 Posted October 23, 2014 (edited) I have a script that works fine, but I'm wondering if I'm not following "best practices" guidelines. It's a simple script that maps the middle mouse button to a hotkey used by a clipboard manager. Click on the middle button , anywhere, and the clipboard manager pops up. It loads at start-up and is always running. #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("04", $hDLL) Then Send("^!C") WEnd My question is should I have a Sleep(100), or something, in the loop? It's seems that many examples, that have an infinite loop, do this. Thanks...Jimbo Edited October 23, 2014 by JimmyN
Moderators JLogan3o13 Posted October 23, 2014 Moderators Posted October 23, 2014 Look at AdLibRegister in the help file for an alternative. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Danyfirex Posted October 23, 2014 Posted October 23, 2014 sleep(30) should be e enough. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Solution MikahS Posted October 23, 2014 Solution Posted October 23, 2014 (edited) Adlib example: #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") AdlibRegister('Pressed') OnAutoItExitRegister('Quit') While 1 ; run indefinitely WEnd Func Pressed() If _IsPressed("04", $hDLL) Then Send("^!C") EndFunc Func Quit() DllClose($hDLL) EndFunc Edited October 23, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
MikahS Posted October 27, 2014 Posted October 27, 2014 Thanks! Anytime Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
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