[jawsscripts] hotkeys for switching windows

  • From: Theodore Cooke <theodorecooke@xxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Fri, 16 Apr 2021 18:02:05 -0400

Hello folks.

I have never fully been satisfied with the options for switching
windows. Alt-tabbing gets a bit verbose when I'm frequently switching
between 3-4 windows, as is common when developing. Using Jawskey+f10
often ends up requiring me to type a few more keys than I prefer. I
tried searching the interwebs, but could not find any way for setting
up hotkeys to switch to a given window.

Turns out this problem is not too difficult to solve with Jaws
scripts. I have a system of hotkeys set up that allow me to mark a
window with Jawskey+ctrl+number, then I can switch to that window with
Jawskey+alt+number. For example, when coding, I'll type Jawskey+ctrl+1
in my compiler window, Jawskey+ctrl+2 in my text editor,
Jawskey+ctrl+3 in file explorer and so on. Then I can switch to the
compiler with Jawskey+alt+1 ETC.

The only problem is that after a long session of using these
keystrokes many times, Window's native alt+tab behavior malfunctions.
It gets to a point that alt+tabbing only cycles between the current
window and the most recent window, as if no other windows were open.
For some strange reason, alt-shift-tabbing works, but not alt-tabbing.

I am wondering if anybody could look at this code or try running it
then telling me what you think the problem might be.

:default.jss
include "HJConst.jsh"

use "default.jsb"

globals
        HandleArray windows
        
Void Function SetBookmarkedWindow (int index)
if not windows then windows = new HandleArray[10] endIf
windows[index] = GetAppMainWindow (GetCurrentWindow ())
say("set bookmarked window number " + IntToString(index), OT_MESSAGE)
EndFunction

Void Function SwitchToBookmarkedWindow (int index)
if windows[index] then
        if windows[index] ==  GetAppMainWindow (GetCurrentWindow ()) then
                say("Already on " + GetWindowName(windows[index]), OT_MESSAGE)
        else
                SetFocus (windows[index])
        endIf
else
        say("Window "+intToString(index)+" not set", OT_ERROR)
endIf
                EndFunction

Script setBookmarkedWindow1 ()
SetBookmarkedWindow(1)
EndScript

Script SwitchToBookmarkedWindow1 ()
SwitchToBookmarkedWindow(1)
EndScript

Script setBookmarkedWindow2 ()
SetBookmarkedWindow(2)
EndScript

Script SwitchToBookmarkedWindow2 ()
SwitchToBookmarkedWindow(2)
EndScript

Script setBookmarkedWindow3 ()
SetBookmarkedWindow(3)
EndScript

Script SwitchToBookmarkedWindow3 ()
SwitchToBookmarkedWindow(3)
EndScript

Script setBookmarkedWindow4 ()
SetBookmarkedWindow(4)
EndScript

Script SwitchToBookmarkedWindow4 ()
SwitchToBookmarkedWindow(4)
EndScript

Script setBookmarkedWindow5 ()
SetBookmarkedWindow(5)
EndScript

Script SwitchToBookmarkedWindow5 ()
SwitchToBookmarkedWindow(5)
EndScript
__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: