반응형
Recent Posts
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- IfInString
- EnvSub
- ControlGetText
- 식
- SetTitleMatchMode
- Var:=식
- SetMouseDelay
- MouseClick
- StringGetPos
- EnvAdd
- 배열
- IF (식)
- 함수
- SetControlDelay
- EnvDiv
- SetKeyDelay
- Menu
- DetectHiddenWindows
- if(식)
- if
- SetEnv
- EnvMult
- ControlSend
- Threads
- 식의 설명
- Blocks
- autohotkey
- EnvSet
- IfWinExist
- API
Archives
- Today
- Total
ㄴrㅎnㅂrㄹrㄱi
GetKeyState 키보드나 mouse button의 눌러 인하 상태, 죠이스틱 상태를 취득 본문
반응형
GetKeyState
키보드나 mouse button의 눌러 인하 상태, 죠이스틱 상태를 취득
GetKeyState, OutputVar, KeyName [, Mode]
Parameters
| 인수명 | 설명 |
|---|---|
| OutputVar | 결과를 격납하는 변수명. 취득에 실패하면, 내용은 비운다. |
| KeyName | 상태를 취득하고 싶은 키의 명칭. 특수 키의 일람은 Key List참조. |
| Mode | 「P」(을)를 지정하면, 소프트웨어적인 키보드 이벤트 생성을 무시해, 실제로 유저가 키를 누르고 있는지를 취득할 수 있다.(NT계 전용)( #InstallKeybdHook, #InstallMouseHook(을)를 기술하는 등,Hook(을)를 유효하게 하고 있을 필요 있어) 「T」(을)를 지정하면,CapsLock,NumLock,ScrollLock의ON/OFF상태를 취득할 수 있다. 이 경우,ON(이)라면 「D」,OFF(이)라면 「U」(이)가 된다. 이 인수는 생략 가능하고, 죠이스틱에서는 무효. |
Remarks
버튼의 경우, 눌러 인하 상태라면 「D」, 밀리지 않으면 「U」(이)가OutputVar의 변수에 격납된다.
죠이스틱의 축(JoyX등)의 경우,0...100의 사이의 소수로 쓰러지는 상태가 나타내진다.(50(이)라면 쓰러지지 않았다)(수치의 서식은 SetFormat그리고 지정 가능)
JoyPOV의 경우,0...35900의 값이 된다.정면을0(으)로 한 각도를100배가 된 것이 되는 모양.
Related
Key List, KeyHistory, #InstallKeybdHook, #InstallMouseHook, GetKeyState()
Example(s)
; Basic Examples:
GetKeyState, state, Shift
GetKeyState, state, CapsLock, T ; D if CapsLock is ON or U otherwise.
GetKeyState, state, RButton ; Right mouse button.
GetKeyState, state, Joy2 ; The second button of the first joystick.
; Advanced Example:
; In this case, the mouse button is kept held down while NumpadAdd
; is down, which effectively transforms NumpadAdd into a mouse button.
; This method can also be used to repeat an action while the user is
; holding down a key or button:
NumpadAdd::
MouseClick, left, , , 1, 0, D ; Hold down the left mouse button.
Loop
{
Sleep, 10
GetKeyState, state, NumpadAdd, P
if state = U ; The key has been released, so break out of the loop.
break
; ... insert here any other actions you want repeated.
}
MouseClick, left, , , 1, 0, U ; Release the mouse button.
return
; Example: Make joystick button behavior depend on joystick axis position.
joy2::
GetKeyState, joyx, JoyX
if joyx > 75
MsgBox Action #1 (button pressed while joystick was pushed to the right)
else if joyx < 25
MsgBox Action #2 (button pressed while joystick was pushed to the left)
else
MsgBox Action #3 (button pressed while joystick was centered horizontally)
return반응형
'AUTOHOTKEY > 레퍼런스' 카테고리의 다른 글
| Gosub 지정 라벨에 점프 해,Return하지만 실행되면 돌아온다 (0) | 2007.11.05 |
|---|---|
| GetKeyState() 키가 눌러 내려지고 있는지 어떤지를 취득하는 함수 (0) | 2007.11.05 |
| FormatTime YYYYMMDDHH24MISS형식의 타임 스탬프를 지정의 서식의 일자 시각 문자열로 변환한다 (0) | 2007.11.05 |
| Floor() 주어진 수치보다 작은 최대의 정수를 돌려주는 함수 (0) | 2007.11.05 |
| FileSetTime 파일이나 폴더의 타임 스탬프를(일괄)변경 (0) | 2007.11.05 |
Comments