So.... I am looking for some trick to detect when the cursor is (or is not) inside of a table cell. I have already examined the hell out of the control names and window text using Window Spy. I can't find anything that is different depending on whether in a cell or not. In fact, OneNote seems to be a bit of an odd fish, in that the individual controls don't show up in Window Spy, only larger groupings of controls. So, looking for the Table tab will not work, as it is buried inside a larger control.
Yes, I know this is a stretch. But.... If you have any ideas, let me know.
For those interested, here is the pertinent code:
Code: Select all
; Insert blank paragraph below current quote (single-cell table).
; WARNING: If you use this hotkey on a regular paragraph, it will cause OneNote to beep at you
; then BACKSPACE OVER ONE CHARACTER. Press Ctrl-z to correct.
; I am working on figuring out a way to detect whether the cursor was in a table cell or if there
; was any text selected after attempting to select the table cell.
; Currently, you just have to only use it when in a table cell.
F22 & F13 Up::
onenote_insert_blank_paragraph_below_current_quote(ThisHotkey)
{
Keywait "F22"
; Select the entire table cell.
Send "{Alt down}{Alt up}jlo"
; Move cursor to end of cell.
Send "{End}"
; Create a new table row beneath it.
Send "{Ctrl down}{Enter}{Ctrl up}"
; Convert that back to a regular paragraph.
Send "{Backspace}"
}
; Separate two "conjoined" quotes, leaving a non-paragraph gap. Cursor must be in top quote.
; WARNING: If you use this hotkey on a regular paragraph, It will cause OneNote to beep at you,
; then it DELETES THE REGULAR PARAGRAPH or DELETES ONE LINE of the above table.
; This may require multiple presses of Ctrl+z to correct.
F22 & F14 Up::
{
onenote_insert_blank_paragraph_below_current_quote(ThisHotkey)
; Remove that blank line in such a way that it leaves table rows separated.
; This also leaves cursor in the subsequent table cell, so user can just keep pressing this key
; to continue separating a list of quotes that got conjoined by moving them around.
; Also has no effect when the bottom paragraph is just a regular paragraph.
Send "{Ctrl down}a{Ctrl up}{Delete}"
}
Versions, Etcetera:
AutoHotkey v2.0-beta.3
Microsoft® OneNote® 2016 MSO (Version 2204 Build 16.0.15128.20210) 32-bit