Take a screen shot and save to desktop with current time as the name

applescript screencapture
how to take a screenshot
screenshot on windows 10
snipping tool
how to screenshot on laptop

I am trying to make a script that will take a screen shot, save the image to the desktop, and name it the date. Similar to what would happen if I used cmd + shift + 3. The only issue is the name of the image is only "Screen" instead of the entire name I specified. Anyone know how to fix this?

on run
    set theDesktop to POSIX path of (path to desktop as string)
    set theCurrentDate to current date
    set shellCommand to "/usr/sbin/screencapture " & theDesktop & "Screen Shot" & theCurrentDate & ".png"
    do shell script shellCommand
end run

Put the complete file path in double quotes, like this:

on run
    set theDesktop to POSIX path of (path to desktop as string)
    set theCurrentDate to current date
    set shellCommand to "/usr/sbin/screencapture \"" & theDesktop & "Screen Shot" & theCurrentDate & ".png\""
    do shell script shellCommand
end run

The file name contains white space, hence, in your version, the command line interprets it as multiple arguments to /usr/sbin/screencapture.

Beginning Ubuntu for Windows and Mac Users, For the current window, you can choose whether or not to include the window border Setting a time delay will allow you to take a screenshot where the PrtScn key Save Screenshot window will appear so you can give the screenshot a name This is useful if you want to paste the image into another application such as  1 – Press the Windows key and the Print Screen key at the same time. Note: The Print Screen key is usually labeled either PrtScn, PrntScrn or Print Scr, depending on the keyboard. 2 – Press the Windows + E key combination to open “File Explorer”, then navigate to the Pictures > Screenshots folder.

The proper way to pass the path above is by using quoted form of:

on run
    set theDesktop to POSIX path of (path to desktop as string)
    set theCurrentDate to current date
    set shellCommand to "/usr/sbin/screencapture " & quoted form of (theDesktop & "Screen Shot" & theCurrentDate & ".png")
    do shell script shellCommand
end run

8 Fastest Ways to Take Screenshots on Windows 10, Taking screenshots is a core part of my job, and I am sure many of If you just want to take a picture of the current window in focus, then For quicker access, you can also create a shortcut to the screenshot folder on your desktop. Automatic naming according to program name also helps easily identify. Type mspaint into the Run field and press Enter. With Microsoft Paint open, and the screenshot still saved in the clipboard, just use Ctrl + V to paste it into Paint or select Paste. Press Ctrl + S or select File > Save as to save the screenshot. At this point, you may notice that the image you saved looks a bit off.

I just use a shell command like this:

screencapture -i ~/Desktop/$(date +%Y%m%d%H%M%S).png

-i is interactive mode (like ⇧⌘4). The default file name format is like this on my installation:

date '+Screen Shot %Y-%m-%d at %-H.%M.%S %p.png'

See man screencapture and man strftime.

If you use AppleScript, the run handler is not needed, /usr/sbin/ is on the path by default, and you can escape arguments with quoted form of.

"Screen Shot " & (current date) & ".png"
do shell script "screencapture ~/Desktop/" & quoted form of result

If the file name looks like Screen Shot Wednesday, May 29, 2013 4/47/15 AM.png in Finder, it's because HFS uses colon as a pathname separator. : in shells appears as / in Finder and vice versa.

How to Take the Best Screenshots on Your Mac, PC, Phone, or Tablet, Need to take a screen capture in Windows, Android, iOS, macOS, or on other devices? Photography used to be a time-consuming, expensive endeavor. Full screen screenshot: PrtScn; Screenshot of current window: Alt + PrtScn The only problem is, most web apps show your name or email address  All you need about to take screenshot. Learn more about to take screenshot

Emulate your keyboard:

-- Take Screenshot
tell application "System Events"
    -- Shift-Command-3
    key code 20 using {shift down, command down}
end tell

key code 20 is the same as number 3

Result:

Screen Shot 2018-11-18 at 12.47.39 pm

Complete list of key codes can be found here:

https://eastmanreference.com/complete-list-of-applescript-key-codes

8 Ways to capture screenshots on a PC, Then, open an image editing program like Paint and paste the picture In Windows, you can also take screenshots of the active window. Its filename will include the name of the game that you are playing and the date and 

How to take screenshots on your Mac, Windows PC, iPhone and , Here's a quick and simple guide to taking screenshots in all four. Current versions (Mojave and Catalina) of the macOS come with a (I found that half the time I tried it, the system refused to take the screenshot), a second, In the search box just below the “Windows Settings” page name, type “prtscn.

Screen Capture command, With the Screen Capture command, users can capture the entire computer screen or an active open window, and save it in a For applications that change titles: If the name of the application window title changes over time, insert a wild card 

How to Take a Screenshot on a PC in 2019, There are a variety of third-party tools for taking screenshots in If you've been a Windows PC user for any length of time, chances are to take a screenshot of your active desktop and save that image to Using the Windows Key screenshots and saves the document, albeit with a standardized file name.

Comments
  • I just did a script for something very similar. I didn't bother to give the full path name for "screencapture" and it worked just fine.
  • Thanks! Im always surprised how difficult problems have such simple answers.
  • This should have been the accepted answer: much more elegant way also. (Note the blank space at the end of "/usr/sbin/screencapture " since Terminal separates variables using blank spaces)