[jawsscripts] Re: hotkeys for switching windows

  • From: Bob <temp@xxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Sat, 17 Apr 2021 06:54:53 +0100

I can’t spot any obvious issues in your code. 
Similar functionality exists in Windows by default though. 
Assuming you use mostly the same apps you can do the following. 

Open the 10 apps you use most frequently. 
Focus the taskbar and work your way across the icons there and using the 
applications menu unpin the ones you don’t use and pin the ones you do that 
aren’t pinned already. 

Now in the order of the apps on the bar you can use Windows + NumberRow key to 
switch to that app. If the app isn’t already open it will be opened. If there 
are multiple copies of that open the Windows key can be held and the number 
tapped multiple times to perform and alt tab but just between that apps 
Windows. 
You can also do Windows + Shift + Number to open another instance of an app 
that is already open. 
Windows + Control + Number also does something but I can’t remember what!

Hope this helps. 

Bob

On 16 Apr 2021, at 23:02, Theodore Cooke <theodorecooke@xxxxxxxxx> wrote:

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


__________�

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

Other related posts: