autohotkey pressione por mais tempo para caps

0

Eu quero pressionar uma tecla por mais tempo para que ela seja pressionada com o deslocamento

Aqui está o que eu tentei:

$a::                                              
KeyWait, a, T0.7                              
If ErrorLevel                               
  send +{a}
Else 
  send {a} 
Return

Ele envia Aa quando a chave está ativa, e eu quero isso em geral (para todas as teclas, sem reescrever um código para cada tecla).

    
por Fayssal Ozilf 18.07.2015 / 09:34

2 respostas

0

Pressione uma tecla por mais de 0,7 segundos para que seja pressionada com o deslocamento:

#UseHook                                ; install the keyboard hook to activate hotkeys not supported in the operating system
; create a string of the keys you want be shifted:
keys := "1,2,3,4,a,b,c,d,SC01B,SC02B"   ; SC01B = scan code of "#"    SC02B = "+"
Loop, parse, keys, ',                   ; retrieves substrings (fields) from the string "keys" one at a time based on the delimiter ","
Hotkey, %A_Loopfield%, pressedkey       ; creates a hotkey of the retrieved field
return


pressedkey:                             ; A_ThisHotkey: the most recently executed hotkey
KeyWait, %A_ThisHotkey%, T0.7           ; wait 0.7 seconds for the key to be released              
If ErrorLevel                           ; the key has not yet been released after 0.7 seconds
{                   
  KeyWait, %A_ThisHotkey%                ; wait for the key to be released     
  if (SubStr(%A_ThisHotkey%, 1, 2) = SC) ; substring: starting position=1 (first character), Length=2 (characters)
    Send +{%A_ThisHotkey%}
  else
    Send +%A_ThisHotkey%
}
else                                     ; the key has been released before the 0.7 seconds limit
{ 
  if (SubStr(%A_ThisHotkey%, 1, 2) = SC) 
    Send {%A_ThisHotkey%}
  else
    Send %A_ThisHotkey%
}
return

EDITAR:

#UseHook  
keys := "1,2,3,4,a,b,c,d,SC01B,SC02B"
Loop, parse, keys, ',  
Hotkey, %A_Loopfield%, pressedkey 
return

pressedkey:
KeyWait, %A_ThisHotkey%, T0.7
If ErrorLevel 
{                   
  KeyWait, %A_ThisHotkey% 
   Send +{%A_ThisHotkey%}
}
else
    Send {%A_ThisHotkey%}
return 
    
por 19.07.2015 / 08:34
0

Pressione por mais tempo para que o UPPERCASE seja uma boa ideia, mas houve problemas ao digitar então eu mudei o objetivo do script que era meu objetivo principal " escrever apenas números enquanto pressionava por mais tempo " já que eu não tenho um teclado numérico no meu teclado este foi o meu código final:

É claro que um agradecimento especial a user3419297

; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         fayssal.Z
; credits to:
;           Great thanks to user3419297 , the whole code made by him 
; Script Function:
;   easy way to write numbers by pressing longer on symbols (no shift or capslock required)
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#UseHook

keys := "sc02,sc03,sc04,sc05,sc06,sc07,sc08,sc09,sc0A,sc0B,sc0C,sc0D"   
   Loop, parse, keys, ',
   Hotkey, %A_Loopfield%, pressedkey
return

pressedkey:
    KeyWait, %A_ThisHotkey%, T0.3                              
      If ErrorLevel
         {                   
          KeyWait, %A_ThisHotkey%
      If (SubStr(%A_ThisHotkey%, 1, 2) = SC)
         Send +{%A_ThisHotkey%}
     Else
         Send +%A_ThisHotkey%
         }
    Else 
         { 
    If (SubStr(%A_ThisHotkey%, 1, 2) = SC) 
         Send {%A_ThisHotkey%}
    Else
         Send %A_ThisHotkey%
        }
return
    
por 19.07.2015 / 11:08

Tags