Screenshot Active Window

A Snippet from: Dorian Ellis

//Note. Make sure to assign this macro a Hot Key.
 
//Show the screenshot in Windows Explorer? yes/no
Let>ShowInFolder=yes
 
//Edit the screenshot in MS Paint? yes/no
Let>EditFile=no
 
//Get the active window
GetActiveWindow>ActiveWin,Xpos,Ypos,Width,Height
 
//Calculate the window size
Let>BottomRightX=Xpos+Width
Let>BottomRightY=Ypos+Height
 
//Get time and date for the filename
Year>TheYear
Month>TheMonth
Day>TheDay
Hour>TheHour
Min>TheMin
Sec>TheSec
 
//Set file path and name
Let>FilePath=%USERDOCUMENTS_DIR%\Screenshots
Let>FileName=%FilePath%\Screenshot-%TheYear%-%TheMonth%-%TheDay%-%TheHour%-%TheMin%-%TheSec%.bmp

//Create the output folder if it doesn't exist
IfNotDirExists>%FilePath%
    CreateDir>%FilePath%
Endif
 
//Capture the screenshot
ScreenCapture>Xpos,Ypos,%BottomRightX%,%BottomRightY%,%FileName%
 
//Show the screenshot in Windows Explorer if ShowInFolder = yes
if>ShowInFolder=yes
    RunProgram>Explorer /select,%FileName%
Endif
 
 
//Edit the screenshot in MS Paint if EditFile = yes
If>EditFile=yes
    RunProgram>msPaint.exe %FileName%
    WaitWindowOpen>Paint*
    WaitReady>1
    WindowAction>1,Paint*
Endif

Select the code above to paste into your macro. Or: View Raw Text

Link: http://www.mjtnet.com/snip.htm?g=58793e580bdb7

Forum Embed Code - click to select all then copy (CTRL-C):

When pasting into the forum do NOT modify the script code or it will not match what is in the database - create a new snippet instead!