How to Automatically Take a Screenshot and Open it in a Editor?

Using the WinKey and PrintScreen keystroke is probably the fastest way to take a full screenshot and automatically save it to a file, in Windows 8 and higher. When using this method, the screenshot image contains your entire screen including the Taskbar and everything. And in most cases, you may have to crop the image before sending or sharing it with someone, so that only the relevant portion is shown.

automatically take screenshot and editor

Alt + PrintScreen can capture the current window but doesn’t save to a file automatically and it can’t capture context menus — so it’s not always the desired option. Personally, I prefer the following script method to Alt + PrintScreen or Snipping Tool when I’m not using a 3rd party screenshot utility.

Using Script to Take Screenshot and Open it in Editor

Here is a script that automates the task of taking a full screenshot using NirCmd and opening the saved PNG file in an image editor (Paint). You can then crop the image and save the file.

'Ramesh Srinivasan,
Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

'Sleep for 2 seconds until the user sets the active Window or menu
WScript.Sleep 2000

'Take full screenshot
WshShell.Run "nircmd.exe " & "sendkeypress rwin+printscreen"

'Sleep again for half a second - wait until the PNG file is written
WScript.Sleep 500

Dim fNewest

'Find the latest PNG file in Screenshots folder and Open it in editor.
SShots = WshShell.ExpandEnvironmentStrings("%userprofile%")
SShots = SShots & "\Pictures\Screenshots"
If Not fso.FolderExists(SShots) Then WScript.Quit
For Each f In fso.GetFolder(SShots).Files
   If UCase(fso.GetExtensionName(f)) = "PNG" Then  
      If fNewest = "" Then
         Set fNewest = f
      ElseIf fNewest.DateLastModified < f.DateLastModified Then
         Set fNewest = f
      End If
   End If
If fNewest <> "" Then WshShell.Run "mspaint.exe " & Chr(34) & fNewest & Chr(34)


  • Download NirCmd (from NirSoft) and move the executable to your Windows folder.
  • Copy the above lines to Notepad and save it with .vbs extension.
  • Create a desktop shortcut to the .vbs (script file), change the shortcut icon and and Pin it to Taskbar.

When a script is used to trigger WinKey + PrintScreen key sequence, the window focus would change (which is not the case when pressing WinKey + PrintScreen manually).

Due to this, your program window would show up with inactive title bar color in the screenshot. To avoid that, the script is set to wait for 2 seconds after it’s being launched and then simulates the keypress event. In the meantime, the user can set the focus back to the appropriate window. The timeout can also be useful if you want to capture a context menu.

Using ShareX to Take Screenshot and Open it in Editor

ShareX is a very useful screenshot utility which has some advanced options such as uploading the captured image to your cloud storage account or sharing the link on social networking sites etc. In ShareX you can configure “after capture” tasks and create task actions which would be carried out automatically.

Set the After capture tasks to “Perform actions”

automatic screenshot and open in editor

And in the Task Settings, enable the checkbox for Paint or any image editor you use. If your image editor isn’t listed, you can add one manually.

automatic screenshot and open in editor

One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

About the author

Ramesh Srinivasan founded back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

Leave a Comment