[BUG?] Windows thinks Quick Reference windows are the same window as the main scrivener window

I use ALT+TAB a lot to switch between programs, and can use it to switch between one scrivener project and another without any problem. I can also switch from scrivener to another program (such as a web browser.) But if I want to switch from the editor to a quick reference window (or vice versa), I cannot do it that way and have to take my hands from my keyboard (not natural for me) and grab the mouse to click on the other window to get there. As far as windows is concerned, they’re the same window.

Can this be fixed?

It’s definitely not a bug; it’s a design choice every developer must make about an application’s subsidiary windows. But we can easily create our own solution in AutoHotkey. The following code sets F4 to toggle the active window’s inclusion on the Alt-Tab list, hiding or revealing the window’s icon accordingly. Useful in Scrivener and in other programs.

F4::
WinSet, ExStyle, ^0x80,A ; Toggle the WS_EX_TOOLWINDOW attribute, which removes/adds the window from the alt-tab list.
Return

Rgds - Jerome

Thanks. I’m not familiar with AutoHotkey, but I’ll give it a try. A few questions then. After I create the script, do I just click F4 to execute it? And what happens to bringing up the Font Dialog then?

Well, when I run this script, from the quick reference window, it does nothing. But if I run it from the main project window, then it takes that window, too, out of being able to ALT+TAB to it.

And, as I guessed, pressing F4 no longer brings up the font dialog.

So, if I can ever find how to make what you say should work to actually work, where can I find a list of keyboard shortcuts (organized by key rather than menu item order) so I can find an available key-combination to use without disabling the current application of F4 to bring up the font dialog.

Thanks,
Micah

I was going to make some suggestions about the AHK script, but when I tested out the Quick Reference Window function using Release Candidate 5, I found that alt-tab did take one between the editing screen and the quick reference window and back. And if one had several quick reference windows open, it recognized all of them too. There’s no need for the AHK script. So I guess the first question is, are you using RC5? If so, then we have to figure out why we have different results with the quick reference window and alt-tab.

Well you’re on the right track, Charlson. I picked F4 at random as a demo with no regard for its other uses, AutoHotkey Help will show you how to specify a better hot key combo, but I have no idea how to determine which ones are in use. You’d start the script from File Explorer, not a particular window; the script continues to run until you exit it from the system tray, and it operates on whichever window is currently active, so if you’re typing into a particular Quick Ref, you should be able to hit the hotkey(s) to toggle its visibility to Alt-Tab.

Discovery and frustration are part of the development process for even the simplest of scripts. I can only recommend you model yours on the examples in the Help.

Good Luck - Jerome

Thanks for giving it a try. I am using RC5. I don’t think I had more than one quick reference window open, but I’ll bet everything I did have several projects open. When I have a moment (perhaps not for 12 or so) I’ll try a variety of scenarios.

Well I’ve done some testing with one project open and trying to use AHK to make the one and only quick reference window I have open available to me with ALT+TAB and nothing happens. It totally ignores me. I’m giving up for today.

To be clear, I open one scrivener project, then open a quick reference window and, with the quick reference window the active window, press F4 (the keypress I’m temporarily using) and then try to ALT+TAB back to the original main project window. Windows shows me a thumbnail picture of the main project window (but not the quick reference window), and nothing happens when I release ALT+TAB, I still have the quick reference window active.

I’ll confirm Comvox’s observation that, at least as of RC5, Quick Ref windows as created are visible to Alt-Tab, so the first press of F4 will actually hide the active window from Alt-Tab. I get this result whether I launch a Quick Ref by right clicking on a browser item and selecting Open > In Quick Reference in the context menu, OR by opening the item in the Copy Holder and switching to Quick Ref by the pane icon. Unless you’ve been opening a Quick Reference some other way, the script would appear to be superfluous.

As for Alt-Tab not actually switching between windows, does Alt-Tab work as you expect when the script isn’t running? And are you certain there’s no reference to Alt-Tab in the script itself, other than in the WinSet comment?

Script and Alt-Tab working as expected as I test in Windows 10. My AHK script is well over 11,000 lines of code, almost all of them devoted to enhancing Scrivener. It’s an incredibly useful and powerful programming language. Hopefully not too much of a dead end in this case.

Rgds - Jerome

Win used to have alt-tab for jumping between main windows and have ctrl-Tab for jumping between sub-windows within applications. Doesn’t it work that way anymore?

I’ve been using the quick reference button to open documents in the quick reference window. Just tried opening it using the right mouse click and saw no difference either way. The problem started before I ever heard of AutoHotkey (which I installed to employ the script you recommended above.)

In short, nothing seems to make a difference. I wonder if it’s my programmable logitech keyboard with built-in functions, and I have to use depress a function key before hitting F4 to perform the F4 action.

On the other hand, when the script is running, pressing F4 in the quick reference window does not bring up the font menu, so it’s doing something, just not putting the quick reference window in the ALT+TAB rotation.

On yet another hand, hitting F4 in the main project window, however, toggles it from the ALT+TAB rotation, which is far from what I wanted. I have to then manually click on that window, press F4 again to get it back into the rotation.

Lastly, it is nice to know that a script can be all-inclusive, thousands of lines with like this, with multiple possible key commands re-programmable, including (can I get a hot damn, here) hotstrings (now that was a welcome discovery!)

I have to say I don’t see CTRL+TAB doing anything.

RC5 user, here’s what’s working for me.

Alt+tab: switch between all windows, including main Scriv and QuickRef windows.
Ctl+tab: switch between binder, left editor, right editor in main Scriv window.

All good. Everything working, same as with RC4.

@Charlson, can you disable the features of your keyboard or try with a different one? Just to rule that out. And ensure that AHK is off. :slight_smile:

Same here, have never had AHK installed and the programmable functions of my keyboard are not used. Also, F4 in from an editor window brings up the Select Font function, same in the QR window.

Oh, yeah. I misspoke when I said CTRL+TAB did nothing for me. It move between the binder and the top/left and bottom/right editors as expected. I was thinking in terms of “Microsoft Windows” windows, not “Scrivener” windows when I said that didn’t work.

When my script isn’t running (which is what I think you mean by “AHK is off”, no matter which keyboard I use, everything works fine, except ALT+TAB fails to allow me to switch between the quick reference window and the main window (even if I’m in the quick reference window, when I press ALT+TAB it shows the main window only, but when I quit ALT+TABbing to get to it, it leaves me in the quick reference window where I started.

Frustrating, but I’m going to give it up for now. Life’s too short.

I have one more thing I want to try, then forget that part. I’ll go back to using my mouse to select the window I want.

I did try using a different (non-programmable) external keyboard, but nothing changed there either.

Okay, before trying to activate F4 (now CTRL+;) from a bunch of different keyboards, I changed the script to the following:

^;:: WinSet, ExStyle, ^0x80, A ; Toggle the WS_EX_TOOLWINDOW attribute, which removes/adds the window from the alt-tab list. if ErrorLevel ; i.e., it's not blank or zero. MsgBox, The window does not exist else MsgBox, The window exists Return

Now when I run the script, open a QR window, press CTRL+; and voila I get the message box saying the window exists.

Now when I ALT+TAB it shows the main window only (not the QR window at all) and when I cycle to another program (this web browser for instance), then CTRL+TAB back to Scrivener, I still wind up only in the QR window. That is to say, no operational difference for me.

Unless there’s some typo (and I’ve scoured this code and the documentation and I don’t see one), I give up. There’s evidently something wonky with my laptop or Windows 10 version.

And, the final thing I wanted to try (not using an external keyboard at all, but relying on my laptop’s awful keyboard) failed to yield a different result.

I give up on this.

On the very bright side, I did learn about—and have great uses for—hotstrings, so yay!

I.
[size=150]FOUND.[/size]
[size=200]IT!!![/size]

I’d like to thank everyone who gave advice on this, but I just decided on a whim to go back to the tutorial and read up on quick reference windows again. I noticed an option (Window->Keep Quick Reference Panels on Top) which I had on. I tried turning it off and lo, and behold, it works for me now!

And, as comvox ([url]https://forum.literatureandlatte.com/t/bug-windows-thinks-quick-reference-windows-are-the-same-window-as-the-main-scrivener-window/49809/5]) so wisely pointed out, I don’t even need to be running the AHK script.

Some followup info: this behavior is almost certainly related to Keep Quick Reference Panels on Top, as I have two projects open now, one with the preference checked and the other not checked, and the one checked doesn’t let me ALT+TAB to the QR windows, but the unchecked one does.

I wonder if the Scratchpad window has this same behavior. Nope. Just checked. I have Scratchpad set to be “always on top” and I am able to Alt+Tab to and from it. Looks like only QR windows with “always on top” are a problem with Alt+Tab.