richie1985 Posted January 28, 2014 Share Posted January 28, 2014 Hi, i want to mark anywhere a telefonumber (websites, mails, etc). than copy it to clipboard (ctrl +c) and call a autoit function. so how can i check if ctrl + c + c was pressed? thx! Erik Link to comment Share on other sites More sharing options...
l3ill Posted January 28, 2014 Share Posted January 28, 2014 richie1985, check the hotkeyset example in the help file. It is already setup to call a function. just change it around to do what you want. Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
richie1985 Posted January 28, 2014 Author Share Posted January 28, 2014 i read the help files, but i cant find to check if "c" was pressed twice! this HotKeySet("^c", "calling") will call the function immediately after pressing ctrl and c, but i will start the function after pressing ctrl and c and c again! Thx! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 28, 2014 Moderators Share Posted January 28, 2014 ritchie1985,You need to check that the "c" key has been re-pressed after the HotKey has been fired - something like this: #include <Misc.au3> #include <MsgBoxConstants.au3> HotKeySet("^c", "_Func") HotKeySet("{ESC}", "On_Exit") Local $hDLL = DllOpen("user32.dll") While 1 Sleep(10) WEnd Func _Func() ; We are here because Ctrl-c was pressed ; First wait until "c" is no longer pressed Do Sleep(10) Until Not (_IsPressed("43", $hDLL)) ; Now we see if "c" is pressed again within a short delay $nBegin = TimerInit() Do If _IsPressed("43", $hDLL) Then MsgBox($MB_SYSTEMMODAL, "Hi", "c was pressed within 500ms of the HotKey") EndIf Sleep(10) Until TimerDiff($nBegin) > 500 EndFunc Func On_Exit() DllClose($hDLL) Exit EndFuncAll clear? Please ask if 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...
richie1985 Posted January 28, 2014 Author Share Posted January 28, 2014 mhh but this will dont copy the marked text to clipboard and the second press of "c" will only detect if i unpress ctrl ... Link to comment Share on other sites More sharing options...
l3ill Posted January 28, 2014 Share Posted January 28, 2014 I dont understand, why do you want to press c the second time? Ctrl C will copy text to the clipboard. Pressing c again at this point will not do much. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
richie1985 Posted January 28, 2014 Author Share Posted January 28, 2014 because its the fastest way i think... i want to press the c twice to let my telefon call this number. the script should not call immediately after pressing strg + c. and copy to clipboard wont work: expandcollapse popup#include <Misc.au3> HotKeySet("^c", "_Func") HotKeySet("{ESC}", "On_Exit") Local $hDLL = DllOpen("user32.dll") While 1 Sleep(10) WEnd Func _Func() ; We are here because Ctrl-c was pressed ; First wait until "c" is no longer pressed $number = ClipGet() $number = StringReplace($number, " ", "") $number = StringReplace($number, "(", "") $number = StringReplace($number, ")", "") $number = StringReplace($number, "+", "") ConsoleWrite("Call:" & $number & @CRLF) Do Sleep(10) Until Not (_IsPressed("43", $hDLL)) ; Now we see if "c" is pressed again within a short delay $nBegin = TimerInit() Do If _IsPressed("43", $hDLL) Then MsgBox(0, "Hi", "c was pressed within 500ms of the HotKey") EndIf Sleep(10) Until TimerDiff($nBegin) > 500 EndFunc Func On_Exit() DllClose($hDLL) Exit EndFunc Link to comment Share on other sites More sharing options...
l3ill Posted January 28, 2014 Share Posted January 28, 2014 Okay so you wnat a script that presses Ctrl + C to cop number to clipboard and then press C again whach is goint to call this number.? Is C already tied in some way to your telephone software? If the answer to both those questions is yes then we need to move some stuff around...:-) My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
richie1985 Posted January 28, 2014 Author Share Posted January 28, 2014 of course i could set another hotkey (for example Ctrl + h or so), but then the user had to press first ctrl c (to copy the number) and than press ctrl h (to call the number). faster is pressing ctrl + c + c user only want to copy a number: pressing ctrl + c (to add it to adressbock or so) user want to call the number: pressing ctrl +c +c thx Link to comment Share on other sites More sharing options...
l3ill Posted January 28, 2014 Share Posted January 28, 2014 Try this test to make sure we on the right page: Does this do what you want? Hot Key is Ctrl + H HotKeySet("^h", "_Func") HotKeySet("{ESC}", "On_Exit") While 1 Sleep(10) WEnd Func _Func() Send("^c") Sleep(3000) Send("c") EndFunc Func On_Exit() Exit EndFunc My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
richie1985 Posted January 28, 2014 Author Share Posted January 28, 2014 not realy, i got it with this function: If _IsPressed("11", $hDLL) Then ;ConsoleWrite("Ctrl is pressed" & @CRLF) If _IsPressed("43", $hDLL) Then ;ConsoleWrite("C is pressed" & @CRLF) Do Sleep(10) Until Not (_IsPressed("43", $hDLL)) $nBegin = TimerInit() Do If _IsPressed("43", $hDLL) Then ;ConsoleWrite("C is pressed again" & @CRLF) calling() EndIf Sleep(10) Until TimerDiff($nBegin) > 500 EndIf EndIf thx for your help! 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