OliverA Posted March 30, 2013 Share Posted March 30, 2013 Hi community i have a problem with hotkeyHotKeySet("{F5}", "Test") While 1 Sleep(100) WEnd Func Test() ConsoleWrite("TEST" & @CRLF) EndFuncIf i press F5 i have a ConsoleWrite, ok is goodBut if i press and I hold down F5 i have multiple ConsoleWrite until i release it, and i want to avoid thisPlease an help, many thanks I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
OliverA Posted March 30, 2013 Author Share Posted March 30, 2013 Both solution are wrong and not working, the first call itself??? The second not work and i can't use _IsPressed for many reason. Thanks anyway I have try to use a flag: HotKeySet("{F5}", "Test") $f = True While 1 Sleep(100) WEnd Func Test() If $f = True Then ConsoleWrite("TEST" & @CRLF) $f = False EndIf EndFunc ;==>Test But work only one time, the second time the flag is false so F5 don't do nothing I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
OliverA Posted March 30, 2013 Author Share Posted March 30, 2013 (edited) Man, did you test what you post? Not working, and i'll repeat i can't use _IsPressed, in the main script i read the Hotkey from another file and _IsPressed don't use standard "abc" but "123" codes Thanks again Edited March 30, 2013 by OliverA I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
JohnOne Posted March 30, 2013 Share Posted March 30, 2013 Use hotkey udf example scripts, you can use NO_REPEAT flag. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
OliverA Posted March 30, 2013 Author Share Posted March 30, 2013 Hotkey UDF use integer values instead of strings, so i have the same problem of _IsPressed but thanks for the suggestion. I thought it was a simple thing to solve I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
JohnOne Posted March 30, 2013 Share Posted March 30, 2013 Then I believe it's time to explain your problem with integers. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
OliverA Posted March 30, 2013 Author Share Posted March 30, 2013 (edited) in the main script i read the Hotkey from another file and _IsPressed don't use standard "abc" but "123" codesThat's mine problem Edited March 30, 2013 by OliverA I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
JohnOne Posted March 30, 2013 Share Posted March 30, 2013 Then I'd suggest you take what you read from another file, and parse it in some fashion to use the integers needed in UDF. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
OliverA Posted March 30, 2013 Author Share Posted March 30, 2013 I'll use it like one's last hope if noone have other solution I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
water Posted March 30, 2013 Share Posted March 30, 2013 This has been asked and solved many times. Did you search the forum? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
OliverA Posted March 30, 2013 Author Share Posted March 30, 2013 Uhm, yes? I have not find anything useful, i'll search berfore post on the forum and on google using site:autoitscript.com I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
water Posted March 30, 2013 Share Posted March 30, 2013 Check for "HotKeySet _IsPressed". My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
OliverA Posted March 30, 2013 Author Share Posted March 30, 2013 Again with IsPressed...i can't use it, too much problem. You can't combine more then once key ( or you need to do if _IsPressed($hexkey) And _IsPressed($hexkey2) then ) and i need to convert the string to the hex value There is no alternative solution like flags or things like that? I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2013 Moderators Share Posted March 30, 2013 OliverA, As you refuse to use the sensible functions provided in AutoIt to do this, you need to think laterally: HotKeySet("{F5}", "_Test") ; Declare a flag Global $fRunning = False While 1 Sleep(10) WEnd Func _Test() If Not $fRunning Then ConsoleWrite("TEST" & @CRLF) ; Set the flag $fRunning = True ; Run a function to clear the flag after a delay AdlibRegister("_Kill_Test", 1000) ; Adjust the delay as required EndIf EndFunc Func _Kill_Test() ; Clear the flag $fRunning = False ; Stop the function AdlibUnRegister("_Kill_Test") EndFunc Not very elegant, but it works. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
OliverA Posted March 30, 2013 Author Share Posted March 30, 2013 AdlibRegister seems a good compromize, i'll test it and let you know, thanks I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
water Posted March 30, 2013 Share Posted March 30, 2013 Again with IsPressed...i can't use it, too much problem.The example you showed us in your OP looks like a simplified version of the problem you try to solve. Can you please explain what you REALLY try to achieve? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2013 Moderators Share Posted March 30, 2013 OliverA,Or you could check which key was pressed as the HotKey fires and then wait for that key to be released:#include <WinAPI.au3> HotKeySet("{F5}", "_Test") HotKeySet("{ESC}", "On_Exit") Global $fRunning = False While 1 Sleep(10) WEnd Func _Test() If Not $fRunning Then ConsoleWrite("TEST" & @CRLF) ; Set flag to prevent multiple firings $fRunning = True ; Which F key was pressed? For $iF_Key = 0x70 To 0x7B If _WinAPI_GetAsyncKeyState($iF_Key) Then ExitLoop EndIf Next ; Wait until it is released While _WinAPI_GetAsyncKeyState($iF_Key) Sleep(10) WEnd ; Clear flag $fRunning = False EndIf EndFunc Func On_Exit() Exit EndFuncA word of warning: do not post any code which checks for more than a few keys (the above checks for the F1-F12 keys only) - this announcement explains why. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
OliverA Posted March 30, 2013 Author Share Posted March 30, 2013 With the Melba's first code ( the adilib ) i have resolved, not like expeted but at last i have "stopped" to run the function every x second. I have read the announcement but i'm "register" only one key, but i don't know what is the key because is in txt file. Thanks to everyone for the effort I'M QUIT FROM THIS FORUM! It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself. In what way? It's easy...just search on google For that people, wish you the best way, Oliver Astone Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2013 Moderators Share Posted March 30, 2013 OliverA,Just to make clear - it does not matter how many keys you want to "register", it is the number of keys you scan within that If _WinAPI_GetAsyncKeyState loop that is the key to whether you are legal or not. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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