AutoHotkey Community

It is currently May 27th, 2012, 4:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: July 11th, 2011, 4:47 am 
Offline

Joined: November 28th, 2010, 10:59 am
Posts: 92
Hi all i want to give a funcitonality to the Alt key when it is pressed a single time without any modifier. I write the following snippet

Alt::
ToolTip, Shift, 610, 0, 2
SendInput {Shift down}
Input, Outputvar, l1 T0.6, {Insert}{LWin}
SendInput %Outputvar%{Shift up}
Tooltip, , , , 2
return

The problem is that perhaps it does what it suppose to do, it also send the original key. In any application where the Alt raise the menu bar like IE or Windows Explorer, the bar is activated, and that **** up the correct action. I don't wan't that. I just want that when the Alt is pressed alone execute only the above snippet and nothing else.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2011, 8:40 am 
Offline

Joined: April 11th, 2011, 10:12 am
Posts: 393
Location: West Yorkshire, England
Please use [ code ][ / code ] tags when posting code, it can be a bit of an eyesore when you don't (especially long code) . . . !!

Anyways, have you tried using "!" instead . . . ??

Code:
!::
ToolTip, Shift, 610, 0, 2
SendInput {Shift down}
Input, Outputvar, l1 T0.6, {Insert}{LWin}
SendInput %Outputvar%{Shift up}
Tooltip, , , , 2
return


[EDIT]
Or if that doesn't work, maybe you could use Escape at the beginning of your code to get it off the menu Alt brings up . . .
So . . .
Code:
!::
SendInput {Esc}
ToolTip, Shift, 610, 0, 2
SendInput {Shift down}
Input, Outputvar, l1 T0.6, {Insert}{LWin}
SendInput %Outputvar%{Shift up}
Tooltip, , , , 2
return

[/EDIT]

_________________
Image

Hope this helps / Thanks <-------- (Delete Appropriate)

Chris


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2011, 4:14 pm 
Offline

Joined: November 28th, 2010, 10:59 am
Posts: 92
Hi Chris, do you test any of the solutions that you offer?
The first solution has this problem:
1. You are remapping the exclamation sign, not the LAlt
And the second:
2. The Escape key **** up any edition in for example: a text field in a webpage, a line in a console like cmd, etc.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2011, 7:20 pm 
Offline

Joined: April 11th, 2011, 10:12 am
Posts: 393
Location: West Yorkshire, England
No, not always as time is usually an issue . . .

I offer my help, and I am sorry if it is not of use, but we can only try . . .

1. Yes, indeed I am, I was thinking of when you use this with another key, like perhaps !s, so thanks for pointing that out . . .

2. Your OP says that it sends the original Alt function also which brings up the File, Edit etc toolbars in IE, and so if you send an escape, it gets you off the File Toolbars and back to the proper window of IE . . .
It would mess up anything else as you pointed, but, like I said, in this case it *could* be beneficial . . .

_________________
Image

Hope this helps / Thanks <-------- (Delete Appropriate)

Chris


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2011, 8:14 pm 
Offline

Joined: October 15th, 2007, 3:10 pm
Posts: 790
Location: England
I don't think this is possible to stop Alt being passed to Windows in the normal way, and I think (but don't quote me on it) that it's something to do with the way Windows aggressively detects the Ctrl-Alt-Del key combination.

Someone may have a workaround though...

_________________
My code is written for AHK Basic unless otherwise specified. This means it may not work in AHK_L (especially Unicode), due to a few known compatibility issues.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2011, 11:59 pm 
Offline

Joined: November 28th, 2010, 10:59 am
Posts: 92
OceanMachine wrote:
I don't think this is possible to stop Alt being passed to Windows in the normal way, and I think (but don't quote me on it) that it's something to do with the way Windows aggressively detects the Ctrl-Alt-Del key combination.

Someone may have a workaround though...


After several attempts i think that you are completely correct. For this situation i search an alternative for what i want and what it comes to my mind was to exchange the Alt Key for other useless key, in my case the Insert key, and try to modify the Insert behavior avoiding in that way the aggressive Alt detection. I make the remap in the hard way, using KeyTweak to modify the registry. After that and with the help of one of the forums guys i create this snippet:

Code:
Insert::
ToolTip, Shift, 610, 0, 2
Input, Outputvar, l1 T0.6, {LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{Capslock}{Numlock}{PrintScreen}{Pause}

IfInString, ErrorLevel, EndKey:
{
   texto := ErrorLevel
   Key := SubStr(texto, 8)
   SendInput !{%Key%}
   Tooltip, , , , 2
   return
}

If GetKeyState("Insert","P")
  SendInput !%Outputvar%
Else
  SendInput +%Outputvar%
Tooltip, , , , 2
return


It almost works as i want. If i press it alone the it shifts up the following character and if a press other key maintaining the insert pressed then it send the corresponding Alt combination. Till the moment the only problem is the Alt tab....that combinations is a little complex and i don't know how to replicate it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 12th, 2011, 12:35 am 
Offline

Joined: October 15th, 2007, 3:10 pm
Posts: 790
Location: England
What is the problem with Alt-Tab that you are having?

_________________
My code is written for AHK Basic unless otherwise specified. This means it may not work in AHK_L (especially Unicode), due to a few known compatibility issues.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 12th, 2011, 1:13 am 
Offline

Joined: November 28th, 2010, 10:59 am
Posts: 92
OceanMachine wrote:
What is the problem with Alt-Tab that you are having?

I don't know how to keep the thumbnail preview open with the tab and shift tab keys working. With the code that i show my alt-tab that in reality is insert-tab only switch to the previous app. That is useful but it isn't how behaves the real alt-tab.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], rbrtryn, Yahoo [Bot] and 65 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group