AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Code of "Enter"-Key?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Stevo
Guest





PostPosted: Tue Feb 01, 2005 2:08 am    Post subject: Code of "Enter"-Key? Reply with quote

hi,

i've the following code

Quote:

CoordMode, ToolTip, Screen

Lwin::
ToolTip, test, 1, 1
Input, Key, L1

IfEqual, Key, T, send, test

ToolTip
Return


i want have written "test" followed by a press of "Enter" - how am I supposed to code the "Enter"-Key?

and what do I have to add in order to end the tooltip-display by pressing the LWin-Key again?

thanks a lot,
Stevo
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Feb 01, 2005 3:06 am    Post subject: Reply with quote

Code:
LWin::
Regular:
Hotkey,LWin,Alternate
Tooltip,test,1,1
Input,Key,L1

IfEqual,Key,T,Send,test{Enter} ; "`n" would work too.
return

Alternate:
Tooltip
Hotkey,LWin,Regular
return


The tooltip will stay open until you press LWin again, and will not close by any other means. Put a blank Tooltip line in the Regular hotkey if you don't want it that way.
Back to top
View user's profile Send private message
Stevo
Guest





PostPosted: Tue Feb 01, 2005 4:21 am    Post subject: Reply with quote

well, it won't close by pressing Lwin again - try it out, it stays open all the time no matter what key I'll press
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Feb 01, 2005 5:04 am    Post subject: Reply with quote

I'm sorry, yes that's definitely a flaw. Add this line to the top of the script to fix it:

Code:
#MaxThreadsPerHotkey 2


Note that the Input you started will stay running until a key is pressed, and that key will not go through to the active window. I'm not sure there's any way to work around this. This script is difficult. Confused Thanks for the challenge, I'll post if I think of some way to improve this!
Back to top
View user's profile Send private message
Stevo
Guest





PostPosted: Tue Feb 01, 2005 5:52 am    Post subject: Reply with quote

ok

by the way: the "`n" as a way to simulate the press of "Enter" works well in notepad, editor, word and Co. but fails when it comes to HTML forms, such as filling in a search term at www.google.com - visit google.com and trigger "test`n" by using AutoHotkey

do you know whats wrong with that?
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Feb 01, 2005 6:43 am    Post subject: Reply with quote

LOL!!!! Surprised Surprised Surprised Laughing Laughing

Ok... here's your problem. As you know (or should know), Internet Explorer, which I'm assuming you're using, is by no means whatsoever standards compliant. Almost every other browser out there adheres to the universally accepted internet standards, except for the universally stupid Microsoft.

This may be an assumption, but it could very well be a correct one: IE isn't properly translating the Linefeed (that "`n" sends) into an Enter keystroke. In such a single-line edit field, "`n" works fine in all three of the other browsers I tried it in, which are all standards compliant. A hefty assumption, but hey, the evidence supports it and my rants need some fresh, hard proof. Laughing
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Tue Feb 01, 2005 1:14 pm    Post subject: Reply with quote

Stevo wrote:
the "`n" as a way to simulate the press of "Enter" works well in notepad, editor, word and Co. but fails when it comes to HTML forms, such as filling in a search term at www.google.com

That's because `n sends Ctrl+Enter. You could use `r to send a plain enter.

Since the sending of `n seems to be a recurring problem, I think I'm going to change the Send command to interpret it as Enter instead of Ctrl+Enter. Does anyone see a problem with that?
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group