Timestamps for take_screnshot{} filenames.

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Timestamps for take_screnshot{} filenames.

Post by eradicator »

What?
Any kind of method to include the date and time in the filename of a screenshot.
(Just in the filename, obvously the mod mustn't know the date).

How? (Example)
Similar to a localized string the date could simply be substituted in the filename, i.e.:

Code: Select all

take_screenshot{path="/some/folder/screenshot_(__TIMESTAMP__).png"}
It would then be nice if it's possible to specify a custom date format, but an undecorated sort-friendly ISO format would be fine too.

Code: Select all

take_screnshot{date_format="%Y-%m-%d_%H%M%S"}
Ideally this should be as simple to implement as (pseudocode):

Code: Select all

if opts.date_format then string.gsub(opts.path,'__TIMESTAMP__',get_formatted_date(opts.date_format)) end
Why?
Because there is currently no good method (that i know of...) to uniquely name screenshots, resulting in an unorderly clutter of files in my script-output folder at best, and overwriting old screenshots with not-unique-afterall names at worst.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Timestamps for take_screnshot{} filenames.

Post by quyxkh »

I use the current ticks for mine, if I cared I'd add a prefix string setting or something. You could trigger renames off inotifywait or however windows does that, it's where I do format conversions, why should the game need to add ops&admin features the os already provides?

Post Reply

Return to “Modding interface requests”