Jump to content

Image is not getting saved from clipboard to a file

Recommended Posts


Hi community,


I used a script which made me save my copied pictures from clipboard to a file on my hard drive.


Today it stopped working? Can someone help me?


So there is a image.jpg file in my clipboard, I double checked, the folder is also correct and exists and no administrator rights are needed. Still the image is not getting saved into the folder.


#include <AutoItConstants.au3>
#include <Misc.au3>
#include <Constants.au3>
#include <ClipBoard.au3>
#include <GDIPlus.au3>
$lol = @ScriptDir &  "\PICTURES\" & TimerInit() & "_Clipboard_Image.jpg"
If Not _ClipBoard_Open(WinGetHandle(AutoItWinGetTitle())) Then MsgBox(0, "", "_ClipBoard_Open failed")
$hClipboardImage = _ClipBoard_GetDataEx($CF_BITMAP)
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hClipboardImage)
$sCLSID = _GDIPlus_EncodersGetCLSID("JPG")
_GDIPlus_ImageSaveToFileEx($hBitmap, $lol, $sCLSID, 0)


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.