I did not code it to update the file, you need to do that.

This was just an example since I don't have or know your real code or scripts you are calling.

Basically once you call a script/function to run that you want to update, then update it with
WriteProfileString ("file name", "section", "key", "string")

There are examples in the manual.