How to copy tags between files automatically?

What I want to do:

In the GUI, select a small set of files from a much larger set.
Run a script/macro/action/whatever that...
finds one of the files with an non-blank (custom) genre field
sets the genre field of all files in the set with blank genre fields to that genre
does the same thing for year, copyright, and other fields as needed

I'll be doing this 800 times or more, so a multi-step process is awkward.

What I've tried:
GUI: requires a complex set of mouse/keyboard/mouse moves, as there aren't shortcut keys for the needed functions, and there are no keyboard macros anyways.
Actions: can't find how to set a variable to a tag, or set a tag to a variable
Export scripts: I can export all genres, then massage the file with grep or a text editor and import it.
I can't find how to send the file through an editor and import it again.
I especially can't find how to integrate these into one step.

Is there any way to accomplish this?

If I could run the pseudocode, this would do the job
JohnRay = ""
For files, forward direction
If JohnRay == "" AND %genre% <> "" set JohnRay = %genre%
If %genre% == "" AND JohnRay <> "" set %genre% = JohnRay
end loop
for files, backwards direction
If JohnRay == "" AND %genre% <> "" set JohnRay = %genre%
If %genre% == "" AND JohnRay <> "" set %genre% = JohnRay
end loop

there's nothing but genres and blanks, so fancy error-checking is unnecessary.

This could be achieved with a filter, I think. Try this filter:
JohnRay MISSING AND %genre% PRESENT
and then you enter the genre in the field (?) JohnRay or apply an action of the type "Format tag field" or use Convert>Tag-Tag Alt-5 for JohnRay with
Format string: %genre%

So: what is JohnRay?

And just a basic thing: MP3tag does not compare data between different files. You would have to find something that can be found in each file.

I would assume that this is an action of the type "Format value"

I haven't seen any documentation of "MISSING" or "PRESENT" - I'll look for that.

JohnRay - say it out loud - is just a variable name that has no risk of overlapping with a MP3tag keyword like "genre". From what I've read, if a variable is DECLARED inside a loop, it's still good after the loop ends, the opposite of most programming languages. Conversely, if you define a variable before a loop, you can't use it in the loop as the loop creates a new variable of that name. So that part looks hairy. But my goal is to load a variable from one file and use that variable to set the tag of a handful of other files. It can do that with access to only one file at a time, IF I can scan both forwards and backwards through the list, or if I can scan the list twice.

I'm not looking to compare two files directly, but to load a variable from one file and then apply it to a handful of others. There's typically from one to twenty files that need tags for each one that's tagged properly.

It's entirely possible that it can't practically be done. Currently the approaches I have are A. dump all the tags into a file, edit the file manually, and import the file again, or B. wade through filenames and track names using the GUI, and select each desired field via mouse (some of them don't have shortcut keys). Both approaches are both tedious and error-prone. The textfile method has much bigger and riskier errors.

See the documentation in general and specifically about flters:

If you have already 1 propery tagged file and a bunch that needs the same data, I would recommend to select all these files and use the tag panel and its dropdown lists in which you will find the data for that field from all the files.
And if there is only 1 file with data, you see only that data in the list.
Then you select or set the data that all files should get and repeat that for all fields that need to be filled and finally press Ctrl-S to save that modification.
IMHO much quicker than the export/import method.

It's a half solution, as I have around 800-1000 songs to do it to (each batch is all the files associated with a recording project i.e song versions, dubs, FX, etc.)

But it's the best I've found. So that it is.