Skip to content

Instantly share code, notes, and snippets.

@dataserver
Created November 30, 2020 18:54
Show Gist options
  • Save dataserver/32a4b79d14b261e9e93cf5f066c2883a to your computer and use it in GitHub Desktop.
Save dataserver/32a4b79d14b261e9e93cf5f066c2883a to your computer and use it in GitHub Desktop.
#SingleInstance, Force
#include, lib\gdip_all.ahk
; https://github.com/tariqporter/Gdip
; https://github.com/tariqporter/Gdip/blob/master/Gdip.ahk
IfNotExist, Screenshots
FileCreateDir, Screenshots
PrintScreen::
FormatTime, TimeString, , yyyy-MM-dd HHmmss
file = %A_WorkingDir%\Screenshots\%TimeString%.png
Screenshot(file)
return
Screenshot(outfile)
{
pToken := Gdip_Startup()
screen = 0|0|%A_ScreenWidth%|%A_ScreenHeight%
pBitmap := Gdip_BitmapFromScreen(screen)
Gdip_SaveBitmapToFile(pBitmap, outfile, 100)
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment