David, You are not pressing alt+Tab twice to get to document 3. You are holding alt and pressing tab twice. If you really pressed alt+tab, released it, you'd be in document 2. When you did it again, the first window it would take you to is the last one that previously had focus, which was document 1. Clear as mud? You might have more success iterating through the children of the desktop window for this rather than manually sending alt+tab keypresses.

On 4/20/2010 8:18 AM, David wrote:
One of my scripting projects, has to send a sequence of Alt-Tabs. To best reproduce my problem, here is what you can try.
1. Use Script Framwork, and create a new script
2. When asked to choose a hotkey, try setting it to Alt-Up arrow (this doesn't affect my probelm, but just to let you try it). 3. After Framework ends, open the script in your editor, and go to the bottom of it, and make the last Sub read the following:
Sub ForwardTab(myKeyId)
 'This routine is called when the hotkey Alt-Down is pressed.
 If Keyboard.KeyDescriberActive Then
  Speak myStrings(myKeyId & "_Description")
 Else
  'Main routine functionality goes here
  Speak "Forward. "
  Keyboard.InsertKey VK_Tab, KmAlt
  Keyboard.InsertKey VK_Tab, KmAlt
 End If
End Sub
4. Save your work, and load it in WE.
5. Open three or four documents/windows on your system.
5. Place yourself in Document1, and press the hotkey (alt-down arrow).
6. The script is meant to send two Alt-Tab sequences, which would have put you into document3. But, here is my problem. What happens, is that the script switches to document2, then immediately throws you back to Document1. Sitting in Document1, and manually pressing Alt-Tab twice, I will pass by document2, and be left in document3. Why won't it work with the script? Due to a timing issue? Or, is there any other stuff going on? Would I have been better off, not using the Framework script, to initially create my script. That is, does the Framework insert any instructions, that could have been omitted here, and that would affect the behavior?
Thanks alot, everyone!

------------------------------------------------------------------------
I am using the Free version of SPAMfighter <http://www.spamfighter.com/len>.
We are a community of 7 million users fighting spam.
SPAMfighter has removed 1485 of my spam emails to date.
The Professional version does not have this message.

Reply via email to