Really interesting and really good 1st prototype .
a) I deleted unnecessary empty Else before End If
Else
Endif
b) undoMgr.leaveUndoContext is moved to the end (before Call CloseAllDocs) to get really one step in UndoManager for changing the Key
c) added new Key to the name of saved file in CloseAllDocs
d) added changing the part of chord to superscript (for example G7 → 7 is changed to Superscript if it isn’t), there is comment rem change next part of chord to Superscript
Happy Birthday-edit-kl1.odt (28.5 kB)
Few tips:
- maybe select case instead the series of if … elseif … elseif
- maybe
array( array(..i), array(...))
and traverse the array instead the seriesIF tDest = "..." then tDest = "..."
- The part of strings "Key = " is redundant, it is possible to use the arrays without one.
- Add the control for inputed Key? See what it does for invalid Key like Fb, E# or mistaked Dx (I use AltGr+X for # and I pressed badly AltGr so I got x instead #) etc.
- Must there be gotos?
If chordChange = "Y" then
chordChange = "Z"
goto SetKey
end if
If chordChange = "A" then goto ChangeB
IF chordChange = "B" then goto SetKey
For me, the Keys are too much complicated and unmemorable, so I don’t know the transformations of Keys. But with gotos it seems there are some “doubled” operations, is it indispensable?
If I understand well, the chords aren’t mixed with text, so it means the chords are in single paragraphs. So it is possible to get raw text from the chords paragraphs, and work with this raw string instead Visible Cursor → there will not be the comparison of Regions in searching. Then rewrite the paragraph with changed string + set Character Style for Superscript parts of chords.