Jump to content
Sign in to follow this  
richie1985

check hotkey ctrl + c + c

Recommended Posts

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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
EndFunc
All clear? Please ask if not. :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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:

#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

Share this post


Link to post
Share on other sites

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...:-)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...