i need a script for only the alphabet

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
vanove
Posts: 13
Joined: 05 Mar 2024, 14:55

i need a script for only the alphabet

05 Mar 2024, 15:47

I want that only the alphabet keyboards will work, when i use this script, but in a hungarian keyboard ...

Im a hungarian poet, and im a mess when im writing so ... im always end up writing to the ..ing nowhere, in the middle of the night, and there is nothing in the monitor, because an hour ago i pushed some not alphabetic keyboard, probably the worst one, and after that some other, so, thats the problem.

can i use v1 or v2 for this?
User avatar
mikeyww
Posts: 28989
Joined: 09 Sep 2014, 18:38

Re: i need a script for only the alphabet

05 Mar 2024, 19:26

Welcome to this AutoHotkey forum!

Are you really referring to keyboards, or just keys?

Code: Select all

#Requires AutoHotkey v2.0
ih := InputHook('V')
ih.KeyOpt('{All}', 'S')
ih.KeyOpt('abcdefghijklmnopqrstuvwxyz{LShift}{RShift}', '-S')
ih.Start
Well, I don't know, but this seems like a pretty tough way to write poetry. On the other hand, I'm not a poet!
vanove
Posts: 13
Joined: 05 Mar 2024, 14:55

Re: i need a script for only the alphabet

06 Mar 2024, 15:20

hi! thanx to the answer!

yeh, i mean the alphabet keys in the keyboard ...

and yeh u are right, i need the enter and the space key too, and this three ? , .

maybe thats enough

and some hungarian alphabet caracter too: ö,ü,ó,é,á,ű,í,ú

thanx for the help!
User avatar
kunkel321
Posts: 1301
Joined: 30 Nov 2015, 21:19

Re: i need a script for only the alphabet

06 Mar 2024, 17:19

I think you can just add them to the list that Mike already made... Like this:

Code: Select all

ih.KeyOpt('abcdefghijklmnopqrstuvwxyz{LShift}{RShift}{Space}?{,}öüóéáűíú.', '-S')
I think braces need to go around the comma {,} but I'm not sure. Try it and see if it works.

Here is the help section:
https://www.autohotkey.com/docs/v2/lib/InputHook.htm#KeyOpt

EDIT: I tried it, and the comma does work. Here, I added Ctrl and Esc, to make it easier to end the script if you need to. Also Enter, so you can make new paragraphs. LOL. You can add/remove different keys that you need/don't need.

Code: Select all

#SingleInstance
#Requires AutoHotkey v2.0

ih := InputHook('V')
ih.KeyOpt('{All}', 'S')
ih.KeyOpt('abcdefghijklmnopqrstuvwxyz{LShift}{RShift}{Space}{Enter}{Ctrl}{Esc}?{,}öüóéáűíú.', '-S')
ih.Start

^Esc::ExitApp  ; Ctrl+Esc exits script
name := "ste(phen|ve) kunkel"
vanove
Posts: 13
Joined: 05 Mar 2024, 14:55

Re: i need a script for only the alphabet

20 Mar 2024, 21:07

so i tried the program , the "enter" for some reason doesnt work, and maybe the arrows will be good, if they will be in active mode, but dont know how to write it in the script

other than that the sript works fine ...

sorry for the late answer, but didnt have too much "good mood" to do anything till now ...
vanove
Posts: 13
Joined: 05 Mar 2024, 14:55

Re: i need a script for only the alphabet

20 Mar 2024, 21:33

and i noticed that the "í" doesnt work, despite the fact that, that is in a script ...
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: i need a script for only the alphabet

21 Mar 2024, 02:06

kunkel321 wrote:
06 Mar 2024, 17:19
I think braces need to go around the comma {,} but I'm not sure. Try it and see if it works.

EDIT: I tried it, and the comma does work.
Try it without braces because there is no reason for them around the comma. They are extraneous in that case.
User avatar
kunkel321
Posts: 1301
Joined: 30 Nov 2015, 21:19

Re: i need a script for only the alphabet

21 Mar 2024, 07:24

vanove wrote:
20 Mar 2024, 21:33
and i noticed that the "í" doesnt work, despite the fact that, that is in a script ...
This is odd... Do the other accented characters öüóéáűú work?
name := "ste(phen|ve) kunkel"
vanove
Posts: 13
Joined: 05 Mar 2024, 14:55

Re: i need a script for only the alphabet

21 Mar 2024, 19:37

the other caracters are working, the enter and the "í" doesnt
User avatar
kunkel321
Posts: 1301
Joined: 30 Nov 2015, 21:19

Re: i need a script for only the alphabet

22 Mar 2024, 07:25

vanove wrote:
21 Mar 2024, 19:37
the other caracters are working, the enter and the "í" doesnt
Sorry, I don't know why it's not working... I can't test it, because I only have an English setup.
name := "ste(phen|ve) kunkel"
vanove
Posts: 13
Joined: 05 Mar 2024, 14:55

Re: i need a script for only the alphabet

22 Mar 2024, 14:38

ok i understand, but the enter?
User avatar
kunkel321
Posts: 1301
Joined: 30 Nov 2015, 21:19

Strange behavior of "Enter" with inputHooks.

23 Mar 2024, 09:26

vanove wrote:
22 Mar 2024, 14:38
ok i understand, but the enter?
Very strange... I tried the code and Enter doesn't work for me either. On a related note: Check out the code here:
viewtopic.php?p=564175#p564135
Enter also doesn't work as expected with that inputHook code.

It makes me think I'm doing the code wrong(???) I checked the documentation, and I does appear right. It's just {Enter}. Also interesting, is that one of the examples at the bottom of the docs/help page has Enter as an end key, and that code does work. So I don't know what the problem is. I'm going to experiment more.

Edit: An interesting test...
Try this code:

Code: Select all

#SingleInstance
#Requires AutoHotkey v2.0
^Esc::ExitApp ; Ctrl+Esc to Exit.

Loop 100 ; <-- Arbitrary value so it doesn't loop forever. 
{
	ih := InputHook("L1")
	ih.Start()
	ih.Wait()
	tooltip(myStr .= ih.Input)
}
As you type characters, they get added to the ToolTip. Note that they appear in the tooltip the instant that they are typed. However Enter is an exception, which only appears after an addition character is typed. (Note also that you can't actually "see" the word Enter. You know it is there, however, because the tooltip gets taller.) edit: Actually... As I think more, the behavior with the tooltip probably makes sense. The enter character puts in a vertical space, but the next line of text doesn't actually exist until you add an additional character. Maybe(?)

EDIT again:
With the below code, Enter is working as expected. Type some characters, then 'space' or one of the other end keys.

Code: Select all

#SingleInstance
#Requires AutoHotkey v2.0
;===================

!+i:: ; alt shift i
{	
	ih := InputHook(,"{Space}{Tab}{Enter}{Esc}")
	ih.Start()
	ih.Wait()

	ih.OnChar := charFunc() 
	ih.OnEnd := endFunc()

	charFunc(*)
	{	Global myStr .= ih.Input 
	}

	endFunc(*)
	{	msgbox('input:`t' myStr '`nendkey:`t' ih.EndKey)
	}
}

^Esc:: ExitApp()
name := "ste(phen|ve) kunkel"
vanove
Posts: 13
Joined: 05 Mar 2024, 14:55

Re: i need a script for only the alphabet

23 Mar 2024, 15:52

Thx, ok, so whats the solution? :) The first script was interesting, i tryed it, the second ... i dont know. But what can i change in the "alphabet script" to make work the enter? I dont mind, if it works that way, what your first script showed me. Its ok. But how can i write it to the "alphabet script"? (sorry im not an expert in this matter, and my english not perfect too)
vanove
Posts: 13
Joined: 05 Mar 2024, 14:55

Re: i need a script for only the alphabet

05 Apr 2024, 12:08

so? anyone has some idea?
User avatar
kunkel321
Posts: 1301
Joined: 30 Nov 2015, 21:19

Re: i need a script for only the alphabet

05 Apr 2024, 14:20

Sorry, I don't know how to make it work.
name := "ste(phen|ve) kunkel"
User avatar
mikeyww
Posts: 28989
Joined: 09 Sep 2014, 18:38

Re: i need a script for only the alphabet

06 Apr 2024, 07:20

Code: Select all

#Requires AutoHotkey v2.0
ih := InputHook('V')
ih.KeyOpt('{All}', '+S')
ih.KeyOpt('abcdefghijklmnopqrstuvwxyz{LShift}{RShift}{Enter}', '-S')
ih.KeyOpt('{Enter}', '+V')
ih.Start
ih.Wait
MsgBox ih.EndReason
vanove
Posts: 13
Joined: 05 Mar 2024, 14:55

Re: i need a script for only the alphabet

16 Apr 2024, 17:17

thanx mikeyww! its almost perfect now:

Code: Select all

ih := InputHook('V')
ih.KeyOpt('{All}', '+S')
ih.KeyOpt('abcdefghijklmnopqrstuvwxyzöőüóéáűíú{LShift}{Space}{RShift}{Up}{Down}{Left}{Right}?.-{Enter}', '-S')
ih.KeyOpt('{Enter}', '+V')
ih.Start
ih.Wait
MsgBox ih.EndReason
i added the arrow keys to the the script, but they doesnt work for some reason, i dont know why ... maybe someone can tell whats the problem ... and how can i put it in the script ...

thanx everyone for the help!

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
User avatar
gregster
Posts: 9226
Joined: 30 Sep 2013, 06:48

Re: i need a script for only the alphabet

16 Apr 2024, 17:20

@vanove, please use code tags when posting code! Thank you.

ctags.png
(14.18 KiB) Downloaded 41 times
User avatar
mikeyww
Posts: 28989
Joined: 09 Sep 2014, 18:38

Re: i need a script for only the alphabet

16 Apr 2024, 18:15

I guess you could try making those keys "visible" along with Enter. In the bugs forum, lexikos has recently posted about the real nature of the issue having to do with how the InputHook handles VK and SC keys.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Descolada, Sacho and 44 guests