Lots of apps are super annoying in how they handle photo folders, not letting us sort photos in an album by name, but only using metadata such as date taken. Google Photos is an example.
Would someone know of an existing script which, when many pictures are selected, allow you to set an initial "Date Taken" date, and sequentially increment that date to all the selected pictures, adding, say, one minute or day to each picture? Searched but couldn't locate.
Do you want to set the 'Date Taken' like that for adding dates to scanned photos? I do that with a plugin for Lightroom Classic, and now thanks to @lxp I can do that in DOpus! Yay!
Almost all applications for viewing and enjoying photos sort by 'Date Taken' by default because typical filenames (like IMG_1234.jpg) offer not value.
In order to always be able to view by date OR filename, I recommend renaming files starting with the 'Date Taken' in the format YYYY-MM-DD. By doing that, the files will sort the same way when sorted by filename or 'Date Taken'.
Which types are involved? Metadata is read-only for most/all raw digital camera formats, and the dates are not supported in BMP images, as a couple of examples.
“It doesn’t work” isn’t very specific. From a glance at the code, it’s calling a global getString function, which (AFAIK) doesn’t exist and presumably results in an error when the script is run.
Opus scripts can use the Dialog object to prompt the user to type in a string.
Believe it or not, you already have the solution for both this problem and another one hiding after that.
Details
What Leo explained: your function getString is undefined, you need to reference it from its origin like so: var date = clickData.func.Dlg.getString("Enter date:");
Bonus problem waiting for you: after the user-cancel check (if (!date) return which you already have), but before the for loop you need to convert the string date to an Opus' Date object, so you need this: date = DOpus.Create().Date(date); (otherwise the date.Format call you have below would fail).