
In my region, this command produces the following example output where the value of the theDateTimeNow variable would be, e.g.: at 12.04.30 PMīetween the line of code above and the two lines that follow it in the script, they produce, e.g.: Screen Shot at 12.04.30 PM.png You may need to adjust the following line of code for it to be as in your region: set theDateTimeNow to (do shell script "date \"+%Y-%m-%d at %l.%M.%S %p\"") The file naming convention is that of the macOS default for Screen Shots saved normally, in my region.
2 By default, ⇧⌘5 in macOS Mojave is by assigned to a new Screenshot feature, so try ⇧⌘6 instead. 1 In macOS Mojave, a Service in Automator is now called a Quick Action, so select that. Now when you press ⇧⌘5 2 the crosshair cursor appears just as though you had pressed ⇧⌘4, however after making the selection as normal and releasing the mouse, the selected area is both copied to the clipboard and saved to a file on the Desktop. Screen Shot to Clipboard and File ⇧⌘5 2. Assign a shortcut, in System Preferences > Keyboard > Shortcuts > Services:. Save the Automator Service 1 as, e.g.: Screen Shot to Clipboard and File.
With the example AppleScript code shown further below:
Add a Run AppleScript action, replacing the default code. Service receives (no input) in (any application). In Automator, create a new Service 1 with the following settings: I'd use Automator to create a Service 1 workflow, to which a keyboard shortcut could be assigned, to run an AppleScript script to have these two events happen in conjunction with each other.
The following is an example of what I'd do, if I needed both, to place a screen shot on the clipboard and save it as a file at the same time.