Screenshots: elapsed time issue

I use screen captures a lot. For many years I have used Gadwin Printscreen: I have it configured to save a file quietly, named in accordance with my preferred pattern, in the location of my choice. For dual monitor setups it can capture whichever screen the cursor is on ... mostly ... but sometimes, if the cursor is on screen 2, all I get is a black image; I've yet to figure out why that's intermittent.

So I was delighted to find that I can do the job in Opus. To make it work the way I want, I use this code:

clipboard screenshot=save,all,name:Screenprint,format:jpg,quality:100,quiet 
copy move D:\desktop\Screenprint.jpg to D:\ScreenPrints\
rename "D:\ScreenPrints\Screenprint.jpg" to="D:\ScreenPrints\{createddate|D#yy}-{createddate|D#MM}-{createddate|D#dd}_{createdtime|T#HHmmss}.{ext}"

which gives me a quiet capture of both screens saved as yy-MM-dd_hhmmss.jpg in the folder of my choice.

However, I've found that it's necessary to wait at least 15 seconds before doing another capture, otherwise the renaming fails:
"An error occurred renaming 'screenprint.jpg'
Cannot create a file when that file already exists. (183)"

To compound this issue, the clock is restarted at the time of the failed attempt, i.e. if I attempt another capture after 14 seconds it will fail, but I must wait a further 15 seconds before I can achieve a successful outcome. The capture process still works (I get the file named "Screenprint.jpg"); but it fails in the renaming.

What's happening? Is there some way I can fix this? If not, is there some way you can fix this?

modified will work better than createddate, e.g.:

Clipboard SCREENSHOT=save,all,name:Screenprint,format:jpg,quality:100,quiet
Rename FROM=/desktop\Screenprint.jpg TO=D:\ScreenPrints\{modified|D#yy-MM-dd_T#HHmmss}.jpg

You can use {date|...} and {time|...} to insert the current date and time into the filename, so you could simplify things a bit more:

clipboard screenshot=save,all,name:Screenprint,format:jpg,quality:100,quiet 
copy move /desktop/Screenprint.jpg to D:\ScreenPrints\ as "{date|D#yy-MM-dd}_{time|T#HHmmss}.jpg"

Thanks, lxp & Leo; both suggested codes are neater and more concise than my (beginner's) code.

But I have tested both, and the underlying problem remains: I must wait at least 15 seconds between captures ... and I can't "jump the start" without incurring a further 15 second penalty!

Mostly this isn't a problem; I'm not in that much hurry, but occasionally I need a much faster repeat rate. (e.g. 90 to 120 screenshots at 6 second intervals, to extract images from an old compiled 3D picture show, so that I can re-compile with an up-to-date aspect ratio. The original compiler (of the show) is no longer with us, and the source files are no longer extant.) And, as I say, I don't bump into the problem with Gadwin Printscreen, which suggests that it's not a Windows issue, (although I must make 2 passes, collecting first the left, then the right images).

I looked through Preferences|Miscellaneous|Advanced (mindful of the warning that it's the scariest page in the whole Preferences system!) to see if I could something like a refresh interval, but had no success.

Well, that's odd, especially if it also happens with Leo's solution. You could use milliseconds {date|D#yy-MM-dd}_{time|T#MHHmmss}.jpg and the WHENEXISTS=rename option to be super safe.

Other ideas:

  • What is drive D: and why/how does your system's desktop point to D:\desktop instead of sitting in C:\Users\<name>\Desktop?
  • If you haven't tried ShareX (https://getsharex.com) you should.

I'm not sure what's going on there. It isn't what I see when testing the button here.

I can push it every second and get a new file without any errors. (Any more often than that and it'll run into problems with existing filenames, of course, due to the naming system being used.)

Something outside of Opus may be interfering by not allowing the files to be moved/deleted for a few seconds, perhaps.

Many MANY thanks to both of you.

lxp:
1/ WHENEXISTS=rename solved the problem; milliseconds not needed.
2/ Thanks for the tip about ShareX. It looks interesting.
3/ OS and installed software are on C:, all of my work is on D: which is on a separate device (SSD); the desktop is the starting point for many of my projects so that they're "in my face", which is why it's on D. It makes backing up simpler for me; I understand it's not to everyone's taste

Leo:
The only other thing I have running is Comodo, as a firewall and extended security. I've fought with it in the past; I will search though its settings in case it's the cause of my issue.

Again: many thanks.

I've been using ShareX for a long time. I recommend it.

Using Leo's script, I can also spam the button with no issues. I am guessing you have the button setup incorrectly?

+1 to ShareX though - It is free, open-source and you can do so much more than you can imagine.