Would it be possible to have the GCode Scripts (->Settings->Printer->GCode scripts) available at e.g. the dashboard. So before printing (or during printing) I could select for the current print that e.g. the GCode script after printing should be run.
This would give some freedom, eg to unload filament after print without having the command in the gcode-file "hardwired".
The options in the settings are a possibility but a bit unpracticle if they should be applied to one print but not another.
You may find the gcode macro plugin useful:
Maybe with some custom controls in the control tab to run the macro commands.
Or also "sidebar macro" (I don't actually know/use this plugin)
These would allow you to run your script however you like.
The Gcode script is attractive since it's executed automatically at a certain instant, eg after the print. I didn't see that in macros addins or the "Terminal Commands Extended" which I use.