關於偵測按鍵

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: 關於偵測按鍵

Re: 關於偵測按鍵

Post by SkyLife » 23 Dec 2017, 21:43

謝謝你的回覆,我已經找到更好的方法了

Re: 關於偵測按鍵

Post by garry » 23 Dec 2017, 14:04

hotkeys ( alt+x... )

Code: Select all

!a::run,notepad
!b::run,calc
!c::run,charmap
;.....

Re: 關於偵測按鍵

Post by SkyLife » 23 Dec 2017, 05:52

你給的例子並不能解決我的問題
這只能知道次數,而且我需要創建無數個熱鍵

Re: 關於偵測按鍵

Post by garry » 23 Dec 2017, 04:24

examples

Code: Select all

;- http://www.autohotkey.com/board/topic/15574-morse-find-hotkey-press-and-hold-patterns/
;- http://www.autohotkey.com/board/topic/9166-fkee3/
;- http://www.autohotkey.com/board/topic/35566-rapidhotkey/

; !n::run,notepad  ;- a hotkey example alt+n

;------- example -------
;- push F1  twice or 3*  
;- write this above the F1-key :
; 2* notepad
; 3* calc 

$F1::
   p := Morse()
   If (p = "00")
        run, notepad
   If (p = "000")
        run,calc
return

$F12::
   p := Morse()
   If (p = "00")
        msgbox, 262144, F12-Key, F12 2 * pushed,2
   If (p = "000")
        msgbox, 262144, F12-Key, F12 3 * pushed,2
return
;--------------------------------------------------

Morse(timeout = 400)
{
   tout := timeout/1000
   key := RegExReplace(A_ThisHotKey,"[\*\~\$\#\+\!\^]")
   Loop
       {
      t := A_TickCount
      KeyWait %key%
      Pattern .= A_TickCount-t > timeout
      KeyWait %key%,DT%tout%
      If (ErrorLevel)
         Return Pattern
       }
}
return
;===================================================

關於偵測按鍵

Post by SkyLife » 23 Dec 2017, 01:03

我希望能偵測到我按下了什麼鍵且能在按下的時候執行命令,像是下面所列的,但是要把所有的按鍵都列進去會需要太多列
evilC發布的UCR有這樣的功能
https://autohotkey.com/boards/viewtopic.php?t=12249
希望有人能幫忙
能偵測鍵盤上的所有按鍵是最好的

Code: Select all

Gui, new
Gui +ToolWindow -Border
Gui, Font, S15
Gui, Add, Text, Center, 按下想要替換的按鍵
Gui, Show
Loop
{
	if getkeystate("A", "P" )
	{
	MsgBox 你按下了A
	ExitApp
	}
	if getkeystate("B", "P" )
	{
	MsgBox 你按下了B
	ExitApp
	}
}
return

Top