AutoHotkey Community

It is currently May 27th, 2012, 6:30 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: AltTab and #If
PostPosted: March 11th, 2011, 10:11 pm 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
#If appears to be ignored in the case of AltTab replacements.
Code:
Var := 0
return

#If Var == "Some value other than 0"
Alt & Up::AltTab
Alt & Down::ShiftAltTab
#If
Try pressing Alt and Up. The hotkey triggers when it shouldn't.

It works fine in the case of a::b replacements. The more practical use of this, and how I discovered it, is making three or more keys for a AltTab by using GetKeyState in the #If.

Edit: I received a PM where the sender said the hotkey didn't trigger on their computer. I tried changing the hotkeys, changing the #If condition, compiling and running in XP compatibility mode. Still it gives me the AltTab behavior.

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


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

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Code:
#IfWinActive No Window With This Name Exist
Alt & Up::AltTab
Alt & Down::ShiftAltTab
#IfWinActive
This is intended I think.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2011, 1:25 am 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
HotKeyIt wrote:
This is intended I think.
Could you explain what you mean?

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


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

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
I think because AltTab and ShiftAltTab should ignore #IfWinActive, otherwise they would not work as expected.
So what is the sense of a hotkey that does AltTab but does not work in all window, so if you select a wrong one it stops working.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2011, 1:55 am 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
I didn't say anything about IfWinActive. I think all #If.. commands should work for it, but I wouldn't argue IfWinActive and IfWinExist.

The case I was talking about is #If condition. For example:
#If GetKeyState("Some Third Key")
or
#If Disable_AltTab (Where this var would be set elsewhere in the script)

I would like to hear Lexikos's comments on if this is a bug or intended behavior.

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2011, 3:16 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
This came up a couple years ago. It wasn't a bug then and still isn't. However, I think it's only mentioned on the #IfWinActive page - I'll add a note to the alt-tab section.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 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