Hey there!
Thanks so much for the quick help. It does roughly what I want it to do. I love that it still numbers accurately even after closing photoshop.
What can I change to make the new document that opens after saving and closing the original have the same size and general settings?
I see sve(+!!F ? f : File(p + '/0.png')), d.add()
Something for the document name like: var p = app.activeDocument
could work?
Right now this:

turns into this:

It would be great if resolution and current filename and document settings was retained so I can for instance have a thirtysecond drawing folder with
figuredrawing1.png
figuredrawing2.png
figuredrawing3.png
...
And then the next day create a document with a different size called
facialexpression.png
save to the same folder with
facialexpression1.png
facialexpression2.png
if (displayDialogs = DialogModes.NO, (d = documents).length) {
function dateMod(v) {return new Date(File(v).modified).getTime()}
f = File(String(F = (p = Folder('/e/Specialization/30seconddrawing'))
.getFiles(/\.png$/i).sort(function(a, b) {return dateMod(a) - dateMod(b)})
.pop()).replace(/(\d+)(?=\.png$)/i, function() {return ++arguments[1]}))
function sve(v){d[0].saveAs(v,png),d[0].close()}
(png = new PNGSaveOptions()).compression = 9
w = d[0].width, h = d[0].height, r = d[0].resolution
n = d[0].name, sve(+!!F ? f : File(p + '/' + n + '1.png'))
d.add(w, h, r, n, NewDocumentMode.RGB, DocumentFill.
WHITE, 1, BitsPerChannelType.EIGHT, 'sRGB IEC61966-2.1')
}
else alert('Open / create at least one document!')
Now it will always use E:\Specialistaion\30seconddrawing path to save your files (name you used creating file + increasing number suffix), while counting now is going to start not from 0, but 1. You also get width, height, resolution and name that will be applied to new document creation, while name additionally for savings. As to rest document settings they will be always the same (so even when you opened document with other, all next ones will keep properties written from script). They are rgb mode, white filling, square pixels, eight bits per channel and some sRGB color profile. If you need others tell me and I replace them, however I try other method to read all documents settings that is called Antion Manager, hard one.