How can i take the ID of the recently saved file in a variable?

As the title says, I'd like to put the ID of the recently saved file into a variable, to use it in a conditional branch after closing the save menu.

If someone knows how to do this possible, it will be so helpful!👋

Also idk if that can be possible but i want the Save Scene closes after saving in a file, is it that possible? and if it is, how?😩
As the title says, I'd like to put the ID of the recently saved file into a variable, to use it in a conditional branch after closing the save menu.
Control Variables -> Script:
  • $gameSystem.savefileId() - most recent save file ID this playthrough.
  • DataManager.latestSavefileId() - most recent save file ID over all playthroughs.
(This is from the up-to-date front page of the MV / MZ Script Call List, under Save & Continue.)

Also idk if that can be possible but i want the Save Scene closes after saving in a file, is it that possible?
By default a successful save pops to the previous scene. Check your plugins?

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-take-the-id-of-the-recently-saved-file-in-a-variable.158574/