https://www.autohotkey.com/board/topic/23162-how-to-copy-a-file-to-the-clipboard/page-1
I found this thread, but it does make the "Paste" option active on the context menu, but nothing really is being pasted.
Here is my AHK script: screenshot -> save file
Code: Select all
#SingleInstance, Force
SetBatchLines, -1
#Include Gdip_All.ahk
#Include FileToClipboard.ahk
class SaveScreen
{
; the first version was, file is being save on "<username>\Pictures\Screenshot"
static Directory := A_AppData . "\DarkWare\shrtct\temp_scrnsht\" ; temp folder before copying the file
static FilePath := SaveScreen.Directory . A_Now . ".png"
static Size := 1.0
Save()
{
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
OnExit("ExitFunc")
FileCreateDir % SaveScreen.Directory
pBitmap := Gdip_BitmapFromScreen()
Width := Gdip_GetImageWidth(pBitmap), Height := Gdip_GetImageHeight(pBitmap)
PBitmapResized := Gdip_CreateBitmap(Round(Width*SaveScreen.Size), Round(Height*SaveScreen.Size)), G := Gdip_GraphicsFromImage(pBitmapResized)
Gdip_DrawImage(G, pBitmap, 0, 0, Round(Width*SaveScreen.Size), Round(Height*SaveScreen.Size), 0, 0, Width, Height)
Gdip_SaveBitmapToFile(PBitmapResized, SaveScreen.FilePath)
Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmapResized)
Gdip_DisposeImage(pBitmap)
FileToClipboard(SaveScreen.FilePath)
Return
}
}
ExitFunc(ExitReason, ExitCode)
{
Gdip_Shutdown(pToken)
ExitApp
Return
}