Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster Favorites with the keyboard #900

Closed
julie777 opened this issue Feb 13, 2023 · 13 comments · Fixed by #902
Closed

Faster Favorites with the keyboard #900

julie777 opened this issue Feb 13, 2023 · 13 comments · Fixed by #902
Assignees
Labels
bug Something isn't working released Available in a released installer

Comments

@julie777
Copy link

Problem to Solve

It takes more keystrokes than I would like to open a favorite. (I do love favorites!)
I have favorites added to the QAT so that <alt>-3 will open the menu. Then I have to move my hand to the arrow keys and scroll while visually searching the list to select the page I want to go to.

New Feature/Solution

(I have no idea if this is possible with the interface available to a OneNote add-in.)

I would like a "type to select" interface for the favorites drop-down.

I like to use Gmail as an example of an efficient interface, and Gmail uses the "type to select" drop-down textbox to filter and select from the menu very nicely for labels.

The Details

  • type <gl> in gmail (which is <alt>-3 for my OneMore favorites).
  • the drop down list of all possible choices opens and shows a text box at the top which captures the following keystrokes, unless they are arrows or <enter>.
  • typing parts of the desired selection reduces the choices available by filtering and at any point the top choice can be selected by <enter>

This is insanely fast because:

  • fingers stay at the home location on the keyboard
  • the list of choices reduces very fast with only a few letters typed
  • it is not required to know the exact name of the selection because the letters can match anywhere in the choice
  • the user quickly learns to type a group of letters and then hit enter for the most commonly used choices

In addition the implementation filter is simple because it is a simple and exact text match.

BTW, it just occurred to me that this is exactly how I open applications in Windows for those not pinned to the task bar and opened with <win>-N.
I open Fusion 360 with <win> f <enter>
I do realize that Windows is remembering past uses to selection Fusion 360 with f instead of Firefox. However, <win>-f-u-<enter> would always work as there are no other apps installed with fu in the name.

My use case is often

  • quickly jump to a favorite page
  • jot down a note or add some information
  • use "return to previous page" to jump back

My QAT starts with Back, Foward, Favorites

@stevencohn
Copy link
Owner

Press Alt+F to open the OneMore Favorites dialog, which has been enhanced a bit in 5.7.0.
Good 'nuf?

@julie777
Copy link
Author

@stevencohn
It is just not fair. You are releasing faster than I can enter issues. <LOL>

I will have to settle for complaining that the installer closed OneNote but didn't reopen it when the install finished.

Oops, I spoke too soon.
(I am about to submit after attempting to make it work. I realize that this is a mess, but it is a chronological log of everything I did to provide you more details.)

<alt>-f and this

image

and the details from the dialog

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Xml.XmlException: The ' ' character, hexadecimal value 0x20, cannot be included in a name.
   at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType)
   at System.Xml.Linq.XName..ctor(XNamespace ns, String localName)
   at System.Xml.Linq.XNamespace.GetName(String localName, Int32 index, Int32 count)
   at River.OneMoreAddIn.FavoritesProvider.<>c__DisplayClass20_0.<ConfirmByName>b__0(XElement n)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at River.OneMoreAddIn.FavoritesProvider.<ConfirmByName>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at River.OneMoreAddIn.FavoritesProvider.<ValidateFavorites>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at River.OneMoreAddIn.FavoritesProvider.<LoadFavorites>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at River.OneMoreAddIn.Commands.Favorites.FavoritesDialog.<BindOnLoad>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4515.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
River.OneMoreAddIn
    Assembly Version: 5.7.0.0
    Win32 Version: 5.7.0
    CodeBase: file:///C:/Program%20Files/River/OneMoreAddIn/River.OneMoreAddIn.dll
----------------------------------------
office
    Assembly Version: 15.0.0.0
    Win32 Version: 15.0.4613.1000
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/office/15.0.0.0__71e9bce111e9429c/office.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4390.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4605.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4550.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Xml.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4605.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Management
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4435.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
System.Web.Extensions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4494.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Web.Extensions/v4.0_4.0.0.0__31bf3856ad364e35/System.Web.Extensions.dll
----------------------------------------
System.Web
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4494.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Web/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
Microsoft.Office.Interop.OneNote
    Assembly Version: 15.0.0.0
    Win32 Version: 15.0.4420.1017
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Office.Interop.OneNote/15.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.OneNote.dll
----------------------------------------
System.Net.Http
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Net.Http/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Net.Http.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Continue let me see the dialog and start typing, but there are no choices.
The last entry in the log doesn't seem useful


26804:1] Starting dllhost 26804, CPU=2904Mhz, en-US/en-US, v5.7.0, OneNote 15.0, Office 16.0
26804:1] ..C:\Program Files\Microsoft Office\root\Office16\ONENOTE.EXE (16.0.16026.20146)
26804:1] ..OnConnection(ConnectionMode:ext_cm_Startup,custom[1:Int32])
26804:1] ..OneAddInsUpdate(custom[])
26804:1] ..building ribbon
26804:1] ..building ribbon colorizer commands
26804:1] ..building ribbon groups
26804:1] ..building context menu
26804:1] ..OnStartupComplete(custom[])
26804:1] ..starting command service
26804:1] ..starting reminder service
26804:1] ..ready
26804:5] defining 148 hotkeys for input locale 1033
26804:9] Running command UpdateCommand
26804:9] Running command GotoFavoriteCommand
26804:9] Running command AboutCommand

Selecting favorites from the ribbon showed the list normally.

I closed and then reopened OneNote and the problem still occurs.
I right clicked in the OneMore section of the ribbon so that I could customize the ribbon to see the command...
This happened.

image

Not sure what happened, as it is not reproducible and I now have the ribbon customize dialog open.
After looking around, I closed the dialog and clicked on favorites and the menu is empty.
image

Closed OneNote and after reopening checked favorites and they are all there.
Open shortcuts from the Favorites menu and it showed the generated page from a version 4 variant where <alt>-f was for search and move/copy.
I deleted the shortcut page and did it again and it generated a new v5 shortcut page which doesn't show the <alt>-f shortcut at all.

Closed OneNote and tried to do a modify/repair install of OneMore to see if that helped and

image

This is getting ugly!

I completely uninstalled OneMore and reinstalled v5.7 and the error still persists when using the shortcut key for favorites.

@jasonjac2
Copy link

jasonjac2 commented Feb 13, 2023

I just updated to 5.7 as well..

I get the same error when invoking the fav's dialogue with Ctrl+f and also when going into manage fav's.

If you want a copy of my favs .xml let me know and I will e-mail them to you.

(tears) as I use this command more than I click on the ribbon!

System.Xml.XmlException: The ' ' character, hexadecimal value 0x20, cannot be included in a name.
at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType)
at System.Xml.Linq.XName..ctor(XNamespace ns, String localName)
at System.Xml.Linq.XNamespace.GetName(String localName)
at System.Xml.Linq.XName.Get(String expandedName)
at System.Xml.Linq.XName.op_Implicit(String expandedName)
at River.OneMoreAddIn.FavoritesProvider.<>c__DisplayClass20_0.b__0(XElement n)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at River.OneMoreAddIn.FavoritesProvider.d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at River.OneMoreAddIn.FavoritesProvider.<ValidateFavorites>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at River.OneMoreAddIn.FavoritesProvider.<LoadFavorites>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at River.OneMoreAddIn.Commands.Favorites.FavoritesDialog.d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__6_0(Object state)

@jasonjac2
Copy link

If I rename my fav's file all is OK, so I think it is parsing the favourites and possibly displaying them.

@stevencohn
Copy link
Owner

@julie777 please kick off an email discussion by contacting me here https://stevencohn.net/#contact

I don't like to post my email in these issues due to junk mail spiders.

@jasonjac2
Copy link

@stevencohn I've e-mailed you a copy of my fav's so you can see which one of the fav's looks like it might cause the issue.

@stevencohn
Copy link
Owner

Got it but it loads fine so I'm hoping Julie's helps diagnose the problem. Meanwhile, I throwing in all kinds of error handling. If it can't read the file, it will start from scratch. But if there's a specific problem, I may be able to fix it.

@julie777
Copy link
Author

Fixes needed

(added after the below was completed)

  1. account for space in the notebook name when looking up notebook using the value of the "label" field in the XML
  2. update the two fixed menu items to include the newly added tooltips

Debugging in progress.

  1. in the favorites menu the fixed entries Add Current Page and Manage Favorites don't get updated with the newly added tooltip.
  2. During my testing at one point after dismissing the error I tried the shortcut again and the "file" page appeared. This reminded me that <alt>-f is normally bound to the file menu. I believe that in any conforming Windows application <alt> should show the menu bar an then the first letter of the menu name is the shortcut to open that menu.
    Ex: <alt>-v in Firefox shows the view menu (even though menus are normally hidden.
    In OneNote the shortcut keys don't match all the ribbon names, but f is the file menu and h is the home ribbon and n is the insert ribbon, etc.
  3. I don't mind overriding the built-in shortcut, but some might. Making it easy to change the OneMore shortcut bindings would fix the possible problem
  4. if OneMore can override the key binding for <alt>-f then maybe that provides a way to replace the normal style shortcut bindings to activate OneMore styles
  5. I isolated a couple of my favorites that when removed from the favorites file get rid of the error

This entry caused the space in the name error

  <button id="omFavoriteLink632739dc2e5ebc62"
          onAction="GotoFavoriteCmd"
          imageMso="GroupInsertLinks"
          label="Politics"
          tag="onenote:///C:\Users\julie\Documents\OneNote%20Notebooks\Misc%20Topics\Politics.one#section-id={05F858A9-E962-4643-BF99-7DB653102642}&amp;end"
          screentip="/Misc Topics/Politics" />

Creating a new favorite for that section resulted in an entry

  <button id="omFavoriteLink63ea5ec57896f98b"
          notebookID="{9F69DA96-C54D-4DB7-88C3-152C0D904748}{1}{B0}"
          objectID="{74E96C1A-D898-0516-33F7-40269D23C824}{1}{B0}"
          onAction="GotoFavoriteCmd"
          imageMso="GroupInsertLinks"
          label="Politics"
          tag="onenote:///C:\Users\julie\Documents\OneNote%20Notebooks\Misc%20Topics\Politics.one#section-id={05F858A9-E962-4643-BF99-7DB653102642}&amp;end"
          screentip="/Misc Topics/Politics" />

Diffing the two entries shows that the button id is different and the following two lines are added.

          notebookID="{9F69DA96-C54D-4DB7-88C3-152C0D904748}{1}{B0}"
          objectID="{74E96C1A-D898-0516-33F7-40269D23C824}{1}{B0}"

I have never done any C# or linq programming so I am still trying to find out what the actual string passed in to cause the error was.

The problem causing the error
All the favorite entries with a space in the notebook name cause the error.
Based on my limited understanding of the code you are using the "label" field in the XML to lookup the notebook and not accounting for notebooks with space in the name.
The newly generated favorite for the same location has exactly the same "label" field, but it has the two additional "id" fields so I believe that you don't need to lookup the notebook and that is why it works with the newly generated entry.

@jasonjac2
Copy link

@julie777 Julie,
I have coding envy now. I started setting up the C# environment ages ago, but didn't get to the point of compiling.

I've also had the issue where alt+f brings up the file menu, but it seems to sort itself out. There are definately some weird things happening if you click or invoke things too quickly. I find clickng off the instance onto another instance and back again seems to fix it (maybe).

Strange the @stevencohn didn't have the error when using my fav's .xml as all the labels have spaces in them.

@stevencohn
Copy link
Owner

stevencohn commented Feb 13, 2023

Making it easy to change the OneMore shortcut ...

You can customize all OneMore shortcuts in the OneMore Settings dialog

maybe that provides a way to replace the normal style shortcut bindings...

The first nine styes defined are also customizable in the Keyboard settings

I can fix the space issue now. It would only happen for existing favorites that were created prior to 5.7 and do not have the notebookID and pageID attributes. If those attributes do not exist, it falls back on the screentip attribute to determine if the page is still valid and that's where it's complaining about the space.

@stevencohn
Copy link
Owner

The Alt problem is transitional. If you just click on the OneMore menu, it re-actives the bindings if they were lost. I haven't figure out why/when it looses the bindings.

@stevencohn
Copy link
Owner

BTW, If an Alt binding is overriden, like Alt+F, you can still press [Alt] followed by [F} will activate the File menu. Not standard, I totally understand, but just an observation

@stevencohn stevencohn added the bug Something isn't working label Feb 13, 2023
@stevencohn stevencohn self-assigned this Feb 13, 2023
@stevencohn stevencohn added the next-release Addressed but not yet released label Feb 13, 2023
@stevencohn stevencohn linked a pull request Feb 13, 2023 that will close this issue
@stevencohn stevencohn added released Available in a released installer and removed next-release Addressed but not yet released labels Feb 15, 2023
@julie777
Copy link
Author

@jasonjac2

@julie777 Julie, I have coding envy now. I started setting up the C# environment ages ago, but didn't get to the point of compiling.

My goal is to update the development setup documentation so that anyone can get it building. You can be the test for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Available in a released installer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants