OK because you are using GLOB_MODPAR_NAME then as you change the parameter the text file is written to.
Then pressing the Cancel button cancels the parameter change but because you are not physically changing the parameter then the text file does not get written back to.
I don't know exactly what you are doing but all I can thing of is to forget the GLOB_MODPAR_NAME and just update the text file anyway.
That just means it will constantly update.
Or add a switch parameter so the user has to turn it "ON" before pressing OK/Cancel to force the change.
You could add a command to set the switch back to "OFF" after the text file is written to.
i.e. if switch = 1 then write text file then set switch = 0
Not so automatic and you are relying on the user to force the update.
Or maybe you could compare the parameter to the value in the text file.
If the parameter does not match the value in the text file then write the parameter to the text file.
This is essentially the same as using GLOB_MODPAR_NAME but without actually using it.
The text file will only update when the parameter is different and the script the write command is in is run (master script is probably the best choice).
Hopefully there is some suggestion here that you might be able to use.
Again it will take testing to confirm if they will work or not - I was just thinking out loud and haven't tested this myself.
Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11