Input for no visible keys

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

Input for no visible keys

Post by Archimede » 26 Mar 2023, 08:29

Hallo.
I am using the function
Input...
for detect all keyboard keys.
I see it can detect all visible keys like alphabetical letters, numbers and so on.
I need to detect all tat AND the no visible keys like Up, PgDown, Home and so on.
For me is no possible to use the EnkKeys Input option , because I am using it for other work.
Do you know how is possible to detect ALL keyboard keys, no only visible keys?

User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Input for no visible keys

Post by mikeyww » 26 Mar 2023, 08:43

You can use an EndKey, examine the EndKey, and then do any number of things with the finding.

Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

Re: Input for no visible keys

Post by Archimede » 26 Mar 2023, 08:54

Yer I know it, but I am using EndKey for other information (any character sequence must be end when to click a specific charater: that specific character is now assegned to EndKey); then I need to find another mode... then, that keys must no defines the end of the input string. Is there another mode?

Rohwedder
Posts: 7647
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Input for no visible keys

Post by Rohwedder » 26 Mar 2023, 08:56

Hallo,
if it is not possible to use the EndKeys of Input (why ever!), then use the EndKeys of InputHook() or something like this:
All currently pressed keys and buttons are displayed. A mouse wheel rotation saves it to the clipboard.

Code: Select all

#InstallKeybdHook
#InstallMouseHook
SetTimer, KeyCombination, 50,% ClipBoard := ""
KeyCombination:
IF A_TimeIdlePhysical > 100
    Return
KeyCombination := KeyCombination()
ToolTip,% KeyCombination?"you are pressing`n" KeyCombination
:"ClipBoard:`n" ClipBoard
Return
*WheelUp::
*WheelDown::ClipBoard := KeyCombination 
KeyCombination(ExcludeKeys:="")
{ ;All pressed keys and buttons will be listed
    ExcludeKeys .= "{Shift}{Control}{Alt}{WheelUp}{WheelDown}"
    Loop, 0xFF
    {
        IF !GetKeyState(Key:=Format("VK{:02X}",0x100-A_Index),"P")
            Continue
        If !InStr(ExcludeKeys,Key:="{" GetKeyName(Key) "}")
            KeyCombination .= RegexReplace(Key,"Numpad(\D+)","$1")
    }
    Return, KeyCombination
}

Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

Re: Input for no visible keys

Post by Archimede » 26 Mar 2023, 09:16

That is interesting, but it is too much slow.
I need to follow the autorepeat key...

User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Input for no visible keys

Post by mikeyww » 26 Mar 2023, 09:29

Code: Select all

#Requires AutoHotkey v1.1.33
Global str := ""
getString()

F3::MsgBox % str

getString() {
 ih := InputHook("V"), ih.KeyOpt("{All}", "E")
 Loop
  ih.Start(), ih.Wait(), str .= "{" ih.EndKey "}"
}
An alternative is using the Hotkey command to create a hotkey for each key.

Rohwedder
Posts: 7647
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Input for no visible keys

Post by Rohwedder » 26 Mar 2023, 11:02

E.g. (with milliseconds between keys):

Code: Select all

Gosub, KeyLInit
q Up:: ;4 seconds keylogging
Log := "", KeyL := A_TickCount
Sleep, 4000
KeyL := False
MsgBox,% Log
Return

#IF KeyL
KeyL:
Log .= -KeyL+(KeyL:=A_TickCount) StrReplace(A_ThisHotkey, "~*", "{") "}"
Return
#IF
KeyLInit:
Hotkey, IF, KeyL
For all, LF in [[0x1FF,"sc{:X}"],[0xFF,"vk{:X}"]]
    Loop,% LF.1
        IF (""<Key:=GetKeyName(Format(LF.2, A_Index)))
		{
            Hotkey, ~*%Key%, KeyL
			Hotkey, ~*%Key% Up, KeyL
		}	
Return

Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

Re: Input for no visible keys

Post by Archimede » 26 Mar 2023, 11:47

mikeyww:
very interesting.
But I need a funclion like
Input...
that waits for any key and automatically capture any key input.

User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Input for no visible keys

Post by mikeyww » 26 Mar 2023, 12:31

That is what the script does.

You can remove the "V" option if you do not want the keys to be visible.

Did you run the script?

What did the script do when you ran it?

Looking further: I don't think that the forum actually supports key loggers. What will you do with yours?

Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

Re: Input for no visible keys

Post by Archimede » 26 Mar 2023, 17:34

:o
That is no a keylogger.
I am making a very complicate program to allow many access at the same time from many remote access (everyone with a keyboard like a remote command) to a single server, every client to a different screen of the same server.
It is very complicate, I understood how to make it (after many studies) and now I am trying to make it.

User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Input for no visible keys

Post by mikeyww » 26 Mar 2023, 18:25

OK. I'll be interested to know whether any of the scripts posted here work.

Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

Re: Input for no visible keys

Post by Archimede » 26 Mar 2023, 19:17

I am working about home automation, a new and different system.
It is very complicate, but I would be very happy to make it with a free group.
Last edited by Archimede on 27 Mar 2023, 03:24, edited 1 time in total.

User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Input for no visible keys

Post by mikeyww » 26 Mar 2023, 19:55

What has happened in this thread so far:
1. You have asked a question.
2. You have received two specific answers in the form of different scripts.
3. You have not indicated that you ran either script, and have not indicated any results of such testing.

Wishing you success. I have nothing more to add.

Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

Re: Input for no visible keys

Post by Archimede » 26 Mar 2023, 20:03

Sorry.
I would be no offensive.
To now I no tried all (here now is very late).
When I will try it I will answer about it.

Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

Re: Input for no visible keys

Post by Archimede » 27 Mar 2023, 03:52

This version, without "V" seem very interesting:

Code: Select all

Global str := ""
getString()

F3::MsgBox % str

getString()
{
	ih := InputHook()
	, ih.KeyOpt( "{All}", "E" )
	Loop
		ih.Start()
		, ih.Wait()
		, str .= "{" ih.EndKey "}"
}
Now I try to modify it and then, if I will find a much interesting result, I will write here.
For mikeyww: sorry for the word "buy" I wrote before, it was a my mistake, now I modified it (that was because yesterday was too much late and my translation ability is very small... :(.
Now I modified it.

Post Reply

Return to “Ask for Help (v1)”