Jump to content


Photo

sendraw sends caps when capslock is on


  • Please log in to reply
4 replies to this topic

#1 mikegoin

mikegoin
  • Members
  • 14 posts

Posted 07 January 2012 - 06:15 PM

According to http://www.autohotke...mmands/Send.htm sendraw sends the text as is. Implying to me that it ignores that state of the capslock key. But it still sends it all in uppercase if the Capslock key is on. Is there a way to get it to ignore the state of the capslock key?

Even the SetStoreCapslockMode doesn't apply to the "sendraw" command according to:
http://www.autohotke...apslockMode.htm

Here is what the output looked like when Capslock was on:

root@I-00711 ~]# F=/TMP/HITjUNK;ECHO "--< tcpdump OUTPUT >--">$F;DATE;DATE>>$F;TCPDUMP -NNI ANY HOST 172.30.99.76 -C 10 >> $F 2>> $F &
-bash: /TMP/HITjUNK: No such file or directory
-bash: DATE: command not found
-bash: /TMP/HITjUNK: No such file or directory
[1] 31230
-bash: /TMP/HITjUNK: No such file or directory
[1]+ Exit 1 TCPDUMP -NNI ANY HOST 172.30.99.76 -C 10 >> $F 2>> $F
[root@I-00711 ~]# PS FAUX|AWK '! /ILOG/&&/ 88423 /{PRINT "pid="$2, $(nf-4), $(nf-3), $(nf-2), $(nf-1), $nf}';ECHO;
-bash: PS: command not found
-bash: AWK: command not found
-bash: ECHO: command not found
[root@I-00711 ~]#
[root@I-00711 ~]# LSOF -P `PS FAUX|AWK '! /ILOG/&&/ 88423 /{PRINT $2}'`|TAIL -7;ECHO
-bash: PS: command not found
-bash: AWK: command not found
-bash: TAIL: command not found
-bash: LSOF: command not found
-bash: ECHO: command not found
[root@I-00711 ~]#


But this is what it looked like w/Capslock off:

f=/tmp/hitJunk;echo "--< TCPDUMP output >--">$f;date;date>>$f;tcpdump -nni any host 172.30.99.76 -c 10 >> $f 2>> $f &
ps faux|awk '! /ilog/&&/ 88423 /{print "PID="$2, $(NF-4), $(NF-3), $(NF-2), $(NF-1), $NF}';echo;

lsof -p `ps faux|awk '! /ilog/&&/ 88423 /{print $2}'`|tail -7;echo


I tried this and it didn't work:
+^1::
	SetCapsLockState, off
	sendraw %tcpdcmd%`n   ;tcpdump...
	sleep 900
	sendraw %psfxcmd%`n
	sleep 900
	sendraw %lsofcmd%`n
	SetCapsLockState, on
Return

This is going into a Unix Window. If I run it into a text file it doesn't do it. If I take the capslock off it doesn't do it. Weird behavior.

Any ideas? Thanks, Mike.

#2 JSLover

JSLover
  • Members
  • 920 posts

Posted 08 January 2012 - 03:19 AM

I tried this script...

SendMode, Input

^1::
^+1::
Send, {Raw}lowercase UPPERCASE MiXeDcAsE
return
...& observed the following behavior...
[*:3hsz6mx3]With capslock off, everything is sent like it should be.
[*:3hsz6mx3]With capslock on, after pressing the hotkey, the capslock light goes off, the send happens & then the capslock light comes back on...I find this to be weird/unexpected behavior...is it documented to turn the capslock light off?...can't AutoHotkey send the text without turning the capslock light off? The sent text is as expected tho.
[*:3hsz6mx3]With capslock on or off, after doing the hotkey once, if you continue holding Ctrl or Ctrl+Shift & press 1 again, it prints 1, instead of activating the hotkey again.

This is going into a Unix Window.

...define "a Unix Window"? PuTTY?

If I run it into a text file it doesn't do it.

...define "run it into a text file"...do you mean Notepad?...Notepad is not a "text file" it's a program that edits text files.

Since this problem only happens in "a Unix Window" I think that program is the problem.

#3 Lexikos

Lexikos
  • Administrators
  • 8855 posts

Posted 09 January 2012 - 09:03 AM

According to http://www.autohotke...mmands/Send.htm sendraw sends the text as is.

That isn't quite what it says.

The SendRaw command sends the keystrokes exactly as they appear rather than translating {Enter} to an ENTER keystroke, ^c to Control-C, etc.

All it means is that the characters which are given special meaning on that page do not have special meaning for SendRaw (or following {Raw}).

Implying to me that it ignores that state of the capslock key.

No such implication is intended. Actually, I don't understand how you could come to that conclusion.

But it still sends it all in uppercase if the Capslock key is on.

In order to prevent this, Send and related commands automatically turn off CapsLock by simulating a CapsLock keystroke. However, some applications don't handle this well - probably only applications which do their own handling of keyboard input.

Is there a way to get it to ignore the state of the capslock key?

Use Send {Blind}{Raw}keys. You cannot use SendRaw since it interprets "{" literally. If Capslock is on it will remain on, but alphabetic characters will be sent as though Capslock was off.

Even the SetStoreCapslockMode doesn't apply to the "sendraw" command according to:

That command isn't relevant anyway, since it only affects what happens after the Send is complete.

I find this to be weird/unexpected behavior...is it documented to turn the capslock light off?

It isn't documented very clearly. {Blind} says "the state of Capslock is not changed", which implies that it is changed if {Blind} is omitted. The documentation for SetStoreCapslockMode mentions it, and the very purpose of that command implies that Send toggles Capslock when necessary.

can't AutoHotkey send the text without turning the capslock light off

... and get correct results? No.

With capslock on or off, after doing the hotkey once, if you continue holding Ctrl or Ctrl+Shift & press 1 again, it prints 1, instead of activating the hotkey again.

Clearly not relevant to this thread; it's a limitation of the operating system's handling of hotkeys (i.e. RegisterHotkey). The solution is to use $ or #UseHook.

#4 mikegoin

mikegoin
  • Members
  • 14 posts

Posted 09 January 2012 - 04:41 PM

I tested the hotkey with the Caps On into a Notepad++ window. It pasted in lower case as set in the script.

The unix window I referred to is an NX Client for Windows type of window. That is the output I pasted into the original post from the NX window.

It may be the NX software. I'll have to look at the settings for that. Thanks.

#5 bbwht

bbwht
  • Members
  • 3 posts

Posted 14 June 2012 - 08:09 AM

Try SendPlay {CapsLock}your text here