Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

using Alt + Tab


  • Please log in to reply
15 replies to this topic
Game_Tester_1993
  • Guests
  • Last active:
  • Joined: --
ok so i can't seem to find this on the forums anywhere so don't hate me if someone has already asked this.

In my script i want AHK to swap between windows mid script using a sub that comes up when a variable is a certain state or number. when this sub runs, it does nothing, or int he earlier forms of it, it actually did something but was too fast.

My current code is this:
ScreenSwap:
 Sleep, 100
 Send, {ALTDOWN}
 Sleep, 1200 ; to give time for the Alt + Tab window menu to come up
 Send, {TAB}
 Sleep, 1200
 Send, {ALTUP}
Return
; END ScreenSwap Subroutine

what brought up the Alt Tab window screen to tab between windows for a split second was this:
Send, {ALTDOWN}{TAB}ALTUP}

neither do anything unfortunetly, any help would be really appreciated

girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
your code
Send, {ALTDOWN}{TAB}ALTUP}
my code
Send, {ALT DOWN}{TAB}{ALT UP}
Notice the difference? I do that a lot when I'm in a hurry or I'm tired.
Then use this to help pace the timing of the keystrokes
SetKeyDelay 30,50
Send, {ALT DOWN}{TAB}{ALT UP}

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


Game_Tester_1993
  • Guests
  • Last active:
  • Joined: --
Tried that but didn't work =(

girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
like what part of that didn't work? did any of the keys go through? did you split them up with separate sends and try that? and how about using !{Tab}? is your timing too fast for the windows to respond? Have you tried using it on on notepad? have you something else running in the background that is grabbing the alt or tab keys? did you try sending it by hand in notepad? the phrase "didn't work doesn't really contain a lot of information.

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


Game_Tester_1993
  • Guests
  • Last active:
  • Joined: --
overall did not work, no idea if any keys went through(don't have an AHK Debugger), i did split them up with seperate sends, did not use !{TAB}, timing was 1.2 seconds between each key movement, no, no defiently not, please expand on "Sending it by hand in notepand", sorry for the previous lack of information, is this better?

Game_Tester_1993
  • Guests
  • Last active:
  • Joined: --
ok so using !{TAB} worked, almost, it tabbed and swapped, but for some reason the window didn't actually change, it just stayed on the first some, no idea why but it did perform the correct action, will look into maybe trying to hold down TAB and see if it does anything or maybe shortan the times, thanks so far

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
Wild guess... some obscure hotkey::AltTab
then GoSub that hotkey :?: wish I could test...

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009

Wild guess... some obscure hotkey::AltTab
then GoSub that hotkey :?: wish I could test...

I have tested that and it does not work :(

girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
on my system if i want to switch windows alt-tab gets me INTO the windows switcher routine but another tab while still holding the alt key actually switches the window. But then, i'm using windows vista.

setKeyDelay, 50,50
X::
suspend
Send, {Alt Down}
Sleep 100
Send, {Tab}
Sleep, 100
Send, {Tab}
Sleep 100
Send, {Alt Up}
return

that does the job for me

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


Game_Tester_1993
  • Guests
  • Last active:
  • Joined: --

on my system if i want to switch windows alt-tab gets me INTO the windows switcher routine but another tab while still holding the alt key actually switches the window. But then, i'm using windows vista.

setKeyDelay, 50,50
X::
suspend
Send, {Alt Down}
Sleep 100
Send, {Tab}
Sleep, 100
Send, {Tab}
Sleep 100
Send, {Alt Up}
return

that does the job for me


im using windows 7 and i used

Send, {Alt Down}
Sleep 100
Send, !{Tab}
Sleep, 100
Send, !{Tab}
Sleep 100
Send, {Alt Up}
return

and it swapped windows, but swapped to the wrong one, so im gonna try adding a 3rd one to see if it does the trick

Game_Tester_1993
  • Guests
  • Last active:
  • Joined: --
ok so turns out it works fine, just that the program in trying to switch between doesn't like to swap, i will look more into this, thanks for your help so far

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009
You might try something like this
GroupAdd, AllWin

Tab::

WinGet,WList, List, ahk_group AllWin

WinActivate, ahk_id %WList2%

Return
But the second window retrieved is not always the second in z order (usualy but not always).

Game_Tester_1993
  • Guests
  • Last active:
  • Joined: --
i will try this and i will only have 2 windows open at a time, only 2 copys of the client im trying to swap windows between, if this doesn't work i might try remapping the Alt and Tab keys and try it that way. Will let you know hwo it goes

Game_Tester_1993
  • Guests
  • Last active:
  • Joined: --

You might try something like this
Code:
GroupAdd, AllWin
Tab::
WinGet,WList, List, ahk_group AllWin
WinActivate, ahk_id %WList2%
Return
But the second window retrieved is not always the second in z order (usualy but not always).


is it possible that it could be trying to Alt + Tab to the AHK script? or is it just like i thought, the program im using just doesn't like swapping windows, if worse comes to worse, ill just make 2 seperate subs for winactivate and make a second folder for the program and just rename some things here and there

Game_Tester_1993
  • Guests
  • Last active:
  • Joined: --
ok a good friend of mine has given me this link:
http://www.autohotke...WinActivate.htm
it has solved my problem, because i was using 2 windows with the same name, it was activating the topmost, but now i can activate the bottommost one and use that to swap, thanks for all your help anyways