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)
_ClipBoard_Close()
_GDIPlus_Startup()
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hClipboardImage)
$sCLSID = _GDIPlus_EncodersGetCLSID("JPG")
ClipPut($lol)
_GDIPlus_ImageSaveToFileEx($hBitmap, $lol, $sCLSID, 0)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_Shutdown()
sleep(750)

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...