When viewing certain YouTube videos which present a series of pictures with captions, I find that there is too little time to a) read the caption and b) appreciate the picture. If I stop the video, it puts the time line over the caption, which can make it difficult to read.
The script takes a screen capture and writes it to
My Pictures\date\SCnnn.PNG
The SC is for Screen Capture, the date is in yyyyMMdd format (eg 20190325), and the nnn in the file name increments for each new capture.
Note: I run an AHK script all the time, which corrects various spellings, expands abbreviations like "w/e" to "weekend",
capitalises "i" to I, and fires up other scripts I have written.
Into that script, I have written ...
Code: Select all
#insert::
Run C:\Users\USR\Documents\AutoHotKey\PrtScrn.ahk ; I know it's not a document, but that's where I keep it
Return
(I know it's not a document as such, but don't look for logic in the layout of my PC)
Code: Select all
; Explanation of script ...
; The folder used for saving screen captures is, typically, C:\Users\USR\Pictures\Screenshots\20190322
; The directory name, "20190322" is the date in yyyyMMdd format
; Don't forget to change USR to your User in the script.
; Each time the script runs, it scans the directory looking for filenames with the format SCnnn.PNG
; SC = Screen Capture, and nnn is a zero-padded number from 000-999
; The script scans the files and finds the highest number (nnn) and increments it to form a filename for the new capture
; It then scans the screen and saves the screen capture into the folder using the filename developed.
#singleinstance force
FormatTime, dt_string,, yyyyMMdd
datei = C:\Users\USR\Pictures\Screenshots\%dt_string%
ifNotExist, %datei%
FileCreateDir, %datei%
; Read last filename.png - this will be the last one apha-numerically
MaxNum := "000"
Loop, %datei%\*.*
{ if(substr(A_LoopFileName,1,2) = "SC") ; SC = Screen Capture
if(substr(A_LoopFileName,3,3) > MaxNum)
MaxNum := substr(A_LoopFileName,3,3)
}
MaxNum := printf("%03d",MaxNum + 1)
FileNam := "SC" . MaxNum . ".PNG" ; create new filename
datei .= "\"
datei .= FileNam
; I don't know who wrote the lines below, but it wasn't me. Thanks to the author.
pToken := Gdip_Startup() ; Start Gdip
WinGetPos, x, y, w, h, A ; Determine dimension and position of the current window
pBitmap := Gdip_BitmapFromScreen(x "|" y "|" w "|" h) ; Take a screenshot based on the calculated values
Gdip_SaveBitmapToFile(pBitmap, datei) ; Create an image from the liner in the specified directory
Gdip_DisposeImage(pBitmap) ; Remove graphics from memory
Gdip_Shutdown(pToken) ; Close Gdip instance
return
Hope you like it.