<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Robert, thanks for your suggestions, but I still don't get it.<br>
    Is there a way to detect this behaviour automatically in JW Lua or
    not?<br>
    Your suggestion "Move one accidental" is a manual step - or did I
    misunderstand you?<br>
    <br>
    I am looking for a way to automatically detect that this
    FCAccidentalMod behaves differently or that there is a hidden
    FCAccidentalMod. Both doesn't happen at the moment. <br>
    FCAccidentalMod:LoadAt always returns false here in my scripts
    (unless I do some manual steps as in my Youtube video). <br>
    So I don't get this hidden default value -54 EVPU automatically, but
    always 0 EVPU. <br>
    Manual steps are not possible here as this is part of my Perfect
    Layout plug-in.<br>
    <br>
    In Perfect Layout there is a comprehensive accidental placement
    function which improves Finale's default placement of accidentals
    (e.g. move closer together in some cases, allow slightly overlapping
    if there is an accidental with parentheses, look at the shapes of
    the accidentals and see if this allows for better placement (double
    sharps need less vertical space than flats), etc.). <br>
    This works fine on all documents - except for this one.<br>
    <br>
    Best,<br>
    Jan<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 08.07.2020 um 15:57 schrieb Robert
      Patterson:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAACncetMvZQHjUX1sjhM+Ohtc7P+tN=S-tR2D4OQE-L3s=V3AA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>I just tried running your script without modifications and
          it detected the FCAccidentalMod just fine. Steps:</div>
        <div><br>
        </div>
        <div>1. Open accidtest.musx</div>
        <div>2. Open JW Lua and paste in your script.</div>
        <div>3. Run it . (Nothing detected.)</div>
        <div>4. Move one of the accidentals.</div>
        <div>5. Run it. (Detected.)</div>
        <div><br>
        </div>
        <div>I then modified your script slightly to use a separate
          accmod2 for the 2nd note. This works better. It looks like
          FCAccidentalMod doesn't work quite right if you LoadAt for one
          note then reuse the same instance to LoadAt another note.</div>
        <div><br>
        </div>
        <div>I'm wondering if your basic problem is that after saving
          the accimod you are not setting the entry's note flag. (There
          is a function to do this.) Generally speaking, you can find
          out what your code is not doing by using the text dump plugin
          to compare a manual change in Finale with your script's
          changes. If you make the exact same manual change as you want
          from your script, you can find out any discrepancies.</div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Jul 8, 2020 at 8:31 AM
          Jan Angermüller <<a href="mailto:jan@angermueller.com"
            moz-do-not-send="true">jan@angermueller.com</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div> Thanks a lot, Robert, for you super quick replies!<br>
            <div> <br>
              But can I detect this automatically in JW Lua? Maybe you
              use other functions/flags in your plug-in?<br>
              <br>
              When I run this JW Lua code, it always return false when
              trying to load an accidental mod.<br>
              So I haven't been able to detect an existing accidental
              mod here.<br>
              <br>
              for e in eachentry(finenv.Region()) do<br>
                  if not e:IsRest() then<br>
                      local accmod=finale.FCAccidentalMod()<br>
                      accmod:SetNoteEntry(e)<br>
                      local note=e:GetItemAt(0)<br>
                      print(accmod:LoadAt(note))<br>
                      print(accmod.HorizontalPos)<br>
                      note=e:GetItemAt(1)<br>
                      print(accmod:LoadAt(note))<br>
                      print(accmod.HorizontalPos)<br>
                  end<br>
              end<br>
              <br>
              Best,<br>
              Jan<br>
              <br>
              <br>
              <br>
              <div>Am 08.07.2020 um 15:21 schrieb Robert Patterson:<br>
              </div>
              <blockquote type="cite">
                <div dir="ltr">
                  <div>This is a perfect use case for the Enigma Text
                    Dump plugin I sent out a couple of days ago.</div>
                  <div><br>
                  </div>
                  <div>1. Dump your accidtest.musx file using the
                    plugin.</div>
                  <div>2. Nudge an accidental right then left, so its
                    position is unchanged.</div>
                  <div>3. Dump the file again using the plugin.</div>
                  <div>4. Compare.</div>
                  <div><br>
                  </div>
                  <div>I just did it, to make sure it works, but I
                    already knew the answer. This behavior of
                    accidentals had a subtle change around 2000. I don't
                    remember the exact date. If the handle is on the
                    left, it means there is no FCAccidentalMod detail
                    for that note. If it is on the right, it means there
                    is.</div>
                  <div><br>
                  </div>
                  <div>You can use the same process as above to
                    determine what your offsets need to be.</div>
                  <div><br>
                  </div>
                  <div>1. Dump your original accidtest.musx file using
                    the plugin.</div>
                  <div>2. Place the accidental where you want it to be.</div>
                  <div>3. Dump the file again using the plugin.</div>
                  <div>4. Compare</div>
                  <div><br>
                  </div>
                  <div>I hope this helps.</div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                </div>
                <br>
                <div class="gmail_quote">
                  <div dir="ltr" class="gmail_attr">On Wed, Jul 8, 2020
                    at 8:05 AM Jan Angermüller <<a
                      href="mailto:jan@angermueller.com" target="_blank"
                      moz-do-not-send="true">jan@angermueller.com</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px 0.8ex;border-left:1px solid
                    rgb(204,204,204);padding-left:1ex">
                    <div> Jari et al.,<br>
                      <br>
                      here is a weird accidental movement behaviour.<br>
                      <br>
                      When I use the Accidental Mover tool (or
                      FCAccidentalMod -> HorizontalPos) and change
                      the horizontal position to a new value, the
                      accidental jumps onto the notehead (!) and takes
                      the notehead as a new reference position.<br>
                      This Finale document was created with Fin2002a.<br>
                      The normal behaviour is that the change of the
                      horizontal position keeps the reference position
                      (i.e. far before the notehead) and moves only
                      according to the new value.<br>
                      <br>
                      See this video:<br>
                      First the weird behaviour, then the normal
                      behaviour (in the Fin2014 default document):<br>
                      <a
                        href="https://www.youtube.com/watch?v=wRLsU40Kog8"
                        target="_blank" moz-do-not-send="true">https://www.youtube.com/watch?v=wRLsU40Kog8</a><br>
                      <br>
                      While making this video I also noticed, that
                      sometimes the anchor point changed (!).<br>
                      So maybe there used to be a flag in Finale
                      (<=2002) which changed the alignment point of
                      the accidental.<br>
                      Have a look at the 23. second in this video: I
                      click on the anchor point and it suddenly jumps
                      from the right of the accidental to the left of
                      the accidental.<br>
                      <a
                        href="https://www.youtube.com/watch?v=6EjOfAlhwMM#t=20s"
                        target="_blank" moz-do-not-send="true">https://www.youtube.com/watch?v=6EjOfAlhwMM#t=20s</a><br>
                      When the anchor point jumps (but this only happens
                      very seldom, and I can't reproduce it) and I check
                      the FCAccidentalMod it suddenly returns a -54 EVPU
                      value for HorizontalPos. While by default (when
                      the anchor point hasn't jump before) it returns no
                      existing accidental mod and thus a 0 EVPU value.<br>
                      <br>
                      I haven't found a way to detect or to remove this
                      behaviour yet. Probably it's not even possible.<br>
                      Attached is the document with the measure from the
                      video where this weird thing happens.<br>
                      <br>
                      Any ideas?<br>
                      The only thing that came to mind: it was created
                      with Fin2002a. <br>
                      Maybe this was a bug in Fin2002a which they fixed
                      in 2002b? <br>
                      Or this was something available before 2002, but
                      not supported anymore.<br>
                      <br>
                      Best,<br>
                      Jan<br>
                    </div>
                    _______________________________________________<br>
                    JWLua mailing list<br>
                    <a href="mailto:JWLua@jwmusic.nu" target="_blank"
                      moz-do-not-send="true">JWLua@jwmusic.nu</a><br>
                    <a
                      href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
                  </blockquote>
                </div>
                <br>
                <fieldset></fieldset>
                <pre>_______________________________________________
JWLua mailing list
<a href="mailto:JWLua@jwmusic.nu" target="_blank" moz-do-not-send="true">JWLua@jwmusic.nu</a>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" target="_blank" moz-do-not-send="true">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a>
</pre>
              </blockquote>
              <br>
              <pre cols="72">-- 
Jan Angermüller
Dipl.-Ing.(FH) Dipl.-Jur. 
Orchideenstieg 13
22297 Hamburg
Tel. 040 - 28 94 84 82
Mobil 0173 - 99 33 904
<a href="http://www.elbsound.studio" target="_blank" moz-do-not-send="true">www.elbsound.studio</a></pre>
            </div>
          </div>
          _______________________________________________<br>
          JWLua mailing list<br>
          <a href="mailto:JWLua@jwmusic.nu" target="_blank"
            moz-do-not-send="true">JWLua@jwmusic.nu</a><br>
          <a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
JWLua mailing list
<a class="moz-txt-link-abbreviated" href="mailto:JWLua@jwmusic.nu">JWLua@jwmusic.nu</a>
<a class="moz-txt-link-freetext" href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Jan Angermüller
Dipl.-Ing.(FH) Dipl.-Jur. 
Orchideenstieg 13
22297 Hamburg
Tel. 040 - 28 94 84 82
Mobil 0173 - 99 33 904
<a class="moz-txt-link-abbreviated" href="http://www.elbsound.studio">www.elbsound.studio</a></pre>
  </body>
</html>