How can I check the state, did not press any key

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
WhitePremium
Posts: 17
Joined: 29 Apr 2016, 02:35

How can I check the state, did not press any key

31 Oct 2016, 12:46

first, I can't English well;; Please be understanding me. ㅠㅠ

anyway....

i want to run some simple script as many as possible, in every spare moments

but, this script include some 'send' command

so i hope this script run a short moment when i do not any input (except, mousemove...)

otherwise, that script interrupt my input, disturb my working

so i make some one

but it's not perfect...

Code: Select all

F1::
loop,{
	Input , a,V T0.001,
	if(a=""){
		BlockInput, on 	;it's to block interrupt during next send command, for a while
		send,a
		BlockInput, off 
	}
}
return

this script have a problem when i hold a key press

'input command' check too fast to check key press

so if I run this script, and hold press "w" down

this result is that "aaaaaawawwwwwwwwawwwwwwwawawwwawawawwwawawwwwwwwawwwwwwaa"

nevertheless, if i increase "Input time out"

maybe, it can't be able to catch a moment, when i do not any input


please... help me ㅠㅠ :crazy:
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: How can I check the state, did not press any key

31 Oct 2016, 17:49

A_TimeIdlePhysical may be the answer you are looking for. Something like this (untested)...

Code: Select all

#InstallKeybdHook    ; Put this line in the Auto-execute section of your script.

F1::
loop,{
	if(A_TimeIdlePhysical > 100){
		BlockInput, on 	;it's to block interrupt during next send command, for a while
		send,a
		BlockInput, off 
	}
}
return
WhitePremium
Posts: 17
Joined: 29 Apr 2016, 02:35

Re: How can I check the state, did not press any key

31 Oct 2016, 22:15

Shadowpheonix wrote:A_TimeIdlePhysical may be the answer you are looking for. Something like this (untested)...

Code: Select all

#InstallKeybdHook    ; Put this line in the Auto-execute section of your script.

F1::
loop,{
	if(A_TimeIdlePhysical > 100){
		BlockInput, on 	;it's to block interrupt during next send command, for a while
		send,a
		BlockInput, off 
	}
}
return
sorry... it's not look like answer I want...

A_TimeIdle recognize input... not press

so

if use A_TimeIdle or input ... etc

when i press "w" and hold


the result like

" waaaawwwwwwww "


because input processing is that (maybe?)

[ input "w" once. - if i am pressing "w" for 0.5sec - after that, start input "w" each 0.1sec until release "w" ]




I want to run script when i do not any key "press"


it simply

i want to use next script in all keys [this is only for "w"]

not script, just only function

Code: Select all

SetBatchLines, -1

F1::

loop,{ 
	GetKeyState, in, w
	if(in = "U"){
		send, a
		Sleep, 1
	}
	if(in = "D"){
		Sleep, 1
	}
}

F4::
Exitapp
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], peter_ahk and 345 guests