Find Most Recent File – TWO

Activation: called internally by various Macro Express modules.

This macro is never executed by itself, but only by being called during the execution of other macros. Especially macros performing background operations on open files (such as running “LJ.exe,” “Beam.exe,” or EditScor operations) rely on this macro in order to identify the revised file that results from the background operation. Whereas “GLOBAL Find most recent file – ONE” in essence performs an “SM” command within Score in order to create a new time stamp on the open file (thereby allowing it to be identified by the process), some background operations can take long enough so that the revised output file being written to disk is not yet available when the “plugin” attempts to read the revised file back into Score. In simpler terms, the logic is this:

  1. You wish to subject your open file to an EditScor procedure that you want to invoke through a simple command as a plugin.
  2. You invoke the plugin; “GLOBAL Find most recent file – ONE” first types “sm” into Score in order to create a new time stamp. This allows the plugin to find out which file to process by looking for the file with the most recent time stamp within the current directory.
  3. EditScor, executing your script, is invoked in the background, processing the file identified in step (2). The EditScor script is elaborate, resulting in 12,867 changes. As soon as EditScor is finished, it exits and commences writing the revised output file.
  4. The plugin attempts to read the revised file (with the same nomenclature as the open file) into Score, but the write-to-disk procedure initiated by EditScor may not yet have completed due to the extensive revisions. As a result, the plugin would read the unrevised file back into Score, and no changes would be visible. “GLOBAL Find most recent file – TWO” attempts to avoid this potential problem by creating yet another time stamp (assigned to a variable) to which the time stamp of the revised file will be compared until it is equal to or greater that the time stamp assigned internally to the variable just created.
  5. The plugin resumes, reading in the revised file.

Within Macro Express, position this macro into GLOBAL settings:

Posted by Jürgen Selk

initial posting:  24 March 2011.

Download file:

Macro Express module:

  • GLOBAL Find most recent file – TWO

To avoid double-postings of macros on this site, this macro and the support file are included on the REQUIRED MACROS page.