Sign in to follow this  
Followers 0
draconis

Trying to switch between open windows in VS 2010

6 posts in this topic

Hi,

I'm trying to create a script to tab between open windows inside visual studio 2010.

This is what I came up with:

for $i=1 to 1000

Send("^{TAB}") ;

Sleep( 10000);

Next

This works fine in, say, Chrome or Firefox, but not in Visual Studio. I tried to understand why, and I saw that the actual key sequence is slightly different:

  • press and hold Control
  • Click on Tab
  • release Control
Can anybody give me a hand with this? Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

I'm trying to create a script to tab between open windows inside visual studio 2010.

This is what I came up with:

for $i=1 to 1000

Send("^{TAB}") ;

Sleep( 10000);

Next

This works fine in, say, Chrome or Firefox, but not in Visual Studio. I tried to understand why, and I saw that the actual key sequence is slightly different:

  • press and hold Control
  • Click on Tab
  • release Control
Can anybody give me a hand with this? Thanks.

That's exactly what ^{TAB} does. Have you tried pressing Ctrl and releasing it then pressing Tab and releasing it to verify that this is indeed your issue? I am in Chrome right now and it doesn't work at all. Maybe your Chrome is different from mine. Let's assume that it is not.

If that is not your problem, what demonic magic is causing your script not to work on VS2010? It appears that sometimes the keys are not being handled by VS2010, even though they are there being pressed ... :) But wait, when I press Ctrl+Tab that window that shows the open tabs appears. My human fingers are probably very slow compared to the script which can send key presses like that in an instant. Well, if that is the case I have to somehow make the keys be pressed longer. Now I could make a thread about that on the forum, but I could also check the help file. And, as thunderbolt in bright daylight, there it was: http://www.autoitscript.com/autoit3/docs/functions/AutoItSetOption.htm#SendKeyDownDelay

Sorry for the long post, my work day is almost over and I needed something to do.

Edited by Manadar

Share this post


Link to post
Share on other sites

That's exactly what ^{TAB} does. Have you tried pressing Ctrl and releasing it then pressing Tab and releasing it to verify that this is indeed your issue? I am in Chrome right now and it doesn't work at all. Maybe your Chrome is different from mine. Let's assume that it is not.

If that is not your problem, what demonic magic is causing your script not to work on VS2010? It appears that sometimes the keys are not being handled by VS2010, even though they are there being pressed ... :) But wait, when I press Ctrl+Tab that window that shows the open tabs appears. My human fingers are probably very slow compared to the script which can send key presses like that in an instant. Well, if that is the case I have to somehow make the keys be pressed longer. Now I could make a thread about that on the forum, but I could also check the help file. And, as thunderbolt in bright daylight, there it was: http://www.autoitscript.com/autoit3/docs/functions/AutoItSetOption.htm#SendKeyDownDelay

Sorry for the long post, my work day is almost over and I needed something to do.

I did consult the help file and have tried this already, although I'm not sure I handled the option correctly.

Here is the other version I have been using (also doesn't work):

for $i=1 to 1000

Opt("SendKeyDownDelay", 100);

Send("^{TAB}") ;

Sleep( 1000);

Next

Share this post


Link to post
Share on other sites

I did consult the help file and have tried this already, although I'm not sure I handled the option correctly.

Here is the other version I have been using (also doesn't work):

for $i=1 to 1000

Opt("SendKeyDownDelay", 100);

Send("^{TAB}") ;

Sleep( 1000);

Next

Opt("SendKeyDownDelay", 1000);
for $i=1 to 1000    
Send("^{TAB}") ;
Sleep( 1000);
Next

Would be correct. And it works for me brilliantly.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Sorry, still not working. Works everywhere *except* VS 2010.

Maybe related to the fact that when you press this key combination in VS, a small window opens up during the transition?

Edited by draconis

Share this post


Link to post
Share on other sites

Everything works for me. The script runs, I open VS2010, the little tab window that you mentioned appears for almost a full second, then I see another tab. I'm very much suspecting that something else is going on on your end: You're not running the script as it is presented in this thread, or you have addons in VS2010 that are messing things up. I reinstalled my PC with Windows 7 last Saturday and the only thing I installed on it is VS2010 and AutoIt and it works: So, proof enough that it works on a default install.

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
Sign in to follow this  
Followers 0