Jump back to note marker from notes section
Posted: 2014-07-12 03:29:53
Macros to make it possible to return to the position after an inserted note in the text from the notes section with a shortcut. I find this useful. Perhaps some of you might agree with me.
There may be gotchas. It seems to not be possible to insert notes in textboxes and tables so those are not a problem. When it becomes possible to do so, the macro may become less useful... Perhaps someone is aware of cases where swapWithMark: does not work?
Regards,
Martin
-- noteJumpBack
#Use with footnoteInsert or endnoteInsert, macro replacements of ‘Footnote’
#and ‘Endnote’, which sets a mark before inserting the note as a position to
#jump back to. NWP can’t swap with a mark in the main document from a notes section
#so text needs to be inserted in the main document to place the cursor at position
#from where a swap is possible.
$doc = Document.active
$text = $doc.text
$text.insertAtIndex 0, ‘[NWPnoteMark]’
$range = Range.new(0, 13)
$text.deleteInRange($range)
Send Selector ‘swapWithMark:’
Send Selector ‘moveRight:’
-- footnoteInsert
# Set mark before inserting footnote for noteJumpBack to swap with
# from the notes section.
Send Selector ‘setMark:’
Menu ‘Insert:Footnote’
-- endnoteInsert
# Set mark before inserting endnote for noteJumpBack to swap with
# from the notes section.
Send Selector ‘setMark:’
Menu ‘Insert:Endnote’
There may be gotchas. It seems to not be possible to insert notes in textboxes and tables so those are not a problem. When it becomes possible to do so, the macro may become less useful... Perhaps someone is aware of cases where swapWithMark: does not work?
Regards,
Martin
-- noteJumpBack
#Use with footnoteInsert or endnoteInsert, macro replacements of ‘Footnote’
#and ‘Endnote’, which sets a mark before inserting the note as a position to
#jump back to. NWP can’t swap with a mark in the main document from a notes section
#so text needs to be inserted in the main document to place the cursor at position
#from where a swap is possible.
$doc = Document.active
$text = $doc.text
$text.insertAtIndex 0, ‘[NWPnoteMark]’
$range = Range.new(0, 13)
$text.deleteInRange($range)
Send Selector ‘swapWithMark:’
Send Selector ‘moveRight:’
-- footnoteInsert
# Set mark before inserting footnote for noteJumpBack to swap with
# from the notes section.
Send Selector ‘setMark:’
Menu ‘Insert:Footnote’
-- endnoteInsert
# Set mark before inserting endnote for noteJumpBack to swap with
# from the notes section.
Send Selector ‘setMark:’
Menu ‘Insert:Endnote’