Jump to content
Vlad_1996

sending alt+tab+tab changes my input language

Recommended Posts

Vlad_1996

so I need this script to click 2 times (in 2 separate windows) and then reactivate the second to last window (the one that was activated before the script ran). I am running this in the background while I am doing other stuff, and I don't want it to interfere with my actions too much. The first obvious thought was to send alt+tab+tab to get 2 windows back in the order they were activated before the script ran. After 1 cycle, my input language changes from English to Russian. It's really important that it stays English due to some software requirements. Any ideas how to fix it/use different approach to switch back to the previously activated window?

HotKeySet("{END}", "Terminate")

While 1

$pos=MouseGetPos()
MouseClick("left",2500,116,2,0)
MouseClick("left",2500,602,2,0)
MouseMove($pos[0],$pos[1],0)
Send("{ALTDOWN}")
Send("{TAB}")
Sleep(100)
Send("{TAB}")
Send("{ALTUP}")
Sleep (10500)

WEnd

Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

Share this post


Link to post
Share on other sites
Vlad_1996

UPD: script without alt=tab doesn't change the input language. Neither does the alt+tab part run separately. 

Share this post


Link to post
Share on other sites
BrewManNH

Simple, don't use alt-tab to switch between windows, use WinActivate.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Vlad_1996

Was an option, but I don't know which exact window I want to activate. I just want to activate the one that was active prior to running script. Any further suggestions?

Share this post


Link to post
Share on other sites
BrewManNH

First, send is a terribly unreliable method of interacting with windows.

Second, how do you know you want to go back 2 windows every time unless you've gone forward 2 times everytime?

Third, you shouldn't use Alt-Tab to navigate between windows, you need to get the handles of the windows you want to work with, and use WinActivate to switch between them. To do that, read the help file on how.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Zedna

You may programatically get/set keyboard layout, look here:

EDIT: also look at

"C:\Program Files (x86)\AutoIt3\Include\WinAPISys.au3" 

_WinAPI_GetKeyboardLayout()

_WinAPI_SetKeyboardLayout()

Edited by Zedna

Share this post


Link to post
Share on other sites
rudi
Posted (edited)

Hi.

As Zedna stated, to use SEND() is not a good idea at all.

 

BTW: For the German version of Windows, the key combination to toggle the keyboard layout is ALT+LEFTSHIFT

If you do not need the second language keyboard layout, then remove it. As a result there will be no 2nd keyboard layout available, you can toggle to. (so it can't happen any more)

 

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×