Jump to content
Sign in to follow this  
LoneReaper

Put Pictures to Clipboard?

Recommended Posts

LoneReaper

Is it possible to put pictures to the clipboard?

Share this post


Link to post
Share on other sites
Simucal

_ClipPutFile

--------------------------------------------------------------------------------

Copy Files to Clipboard Like Explorer does

#include <Misc.au3>

_ClipPutFile($sFile [, $sSeperator])

So:

_ClipPutFile("C:\Porn.Jpg")

Edited by Simucal

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites
jefhal

_ClipPutFile("C:\Porn.Jpg")

Where are you finding _ClipPutFile? It's not in my <misc.au3> include...

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites
Simucal

Where are you finding _ClipPutFile? It's not in my <misc.au3> include...

I dont use anything but beta, so try there.


AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites
slightly_abnormal

I dont see it either. :">

it's in the very *latest* version

;===============================================================================
;
; Description:      Copy Files to Clipboard Like Explorer does
; Parameter(s):     $sFile      - Full Path to File(s)
;                   $sSeperator - Seperator for multiple Files, Default = '|'
; Requirement(s):   v3.1.1.122+
; Return Value(s):  On Success - True
;                   On Failure - False and
;                                   Sets @ERROR to: 1 - Unable to Open Clipboard
;                                                   2 - Unable to Empty Cipboard
;                                                   3 - GlobalAlloc Failed
;                                                   4 - GlobalLock Failed
;                                                   5 - Unable to Create H_DROP
;                                                   6 - Unable to Update Clipboard
;                                                   7 - Unable to Close Clipboard
;                                                   8 - GlobalUnlock Failed
; Author(s):        Piccaso (Florian Fida)
; Note(s):
;
;===============================================================================
Func _ClipPutFile($sFile, $sSeperator = "|")
    Local $vDllCallTmp, $nGlobMemSize, $hGlobal, $DROPFILES, $i, $hLock
    Local $GMEM_MOVEABLE = 0x0002, $CF_HDROP = 15
    $sFile = $sFile & $sSeperator & $sSeperator
    $nGlobMemSize = StringLen($sFile) + 20 ; 20 = size of DROPFILES whitout buffer
    $vDllCallTmp = DllCall("user32.dll", "int", "OpenClipboard", "hwnd", 0)
    If @error Or $vDllCallTmp[0] = 0 Then
        SetError(1)
        Return False
    EndIf
    $vDllCallTmp = DllCall("user32.dll", "int", "EmptyClipboard")
    If @error Or $vDllCallTmp[0] = 0 Then
        SetError(2)
        Return False
    EndIf
    $vDllCallTmp = DllCall("kernel32.dll", "long", "GlobalAlloc", "int", $GMEM_MOVEABLE, "int", $nGlobMemSize)
    If @error Or $vDllCallTmp[0] < 1 Then
        SetError(3)
        Return False
    EndIf
    $hGlobal = $vDllCallTmp[0]
    $vDllCallTmp = DllCall("kernel32.dll", "long", "GlobalLock", "long", $hGlobal)
    If @error Or $vDllCallTmp[0] < 1 Then
        SetError(4)
        Return False
    EndIf
    $hLock = $vDllCallTmp[0]
    $DROPFILES = DllStructCreate("dword;ptr;int;int;int;char[" & StringLen($sFile) & "]", $hLock)
    If @error Then
        SetError(5)
        Return False
    EndIf
    DllStructSetData($DROPFILES, 1, DllStructGetSize($DROPFILES) - StringLen($sFile))
    DllStructSetData($DROPFILES, 2, 0)
    DllStructSetData($DROPFILES, 3, 0)
    DllStructSetData($DROPFILES, 4, 0)
    DllStructSetData($DROPFILES, 5, 0)
    DllStructSetData($DROPFILES, 6, $sFile)
    For $i = 1 To StringLen($sFile)
        If DllStructGetData($DROPFILES, 6, $i) = Asc($sSeperator) Then DllStructSetData($DROPFILES, 6, 0, $i)
    Next
    $vDllCallTmp = DllCall("user32.dll", "long", "SetClipboardData", "int", $CF_HDROP, "long", $hGlobal)
    If @error Or $vDllCallTmp[0] < 1 Then
        SetError(6)
        $DROPFILES = 0
        Return False
    EndIf
    $vDllCallTmp = DllCall("user32.dll", "int", "CloseClipboard")
    If @error Or $vDllCallTmp[0] = 0 Then
        SetError(7)
        $DROPFILES = 0
        Return False
    EndIf
    $vDllCallTmp = DllCall("kernel32.dll", "int", "GlobalUnlock", "long", $hGlobal)
    If @error Then
        SetError(8)
        $DROPFILES = 0
        Return False
    EndIf
    $vDllCallTmp = DllCall("kernel32.dll", "int", "GetLastError")
    If $vDllCallTmp = 0 Then
        $DROPFILES = 0
        SetError(8)
        Return False
    Else
        $DROPFILES = 0
        Return True
    EndIf
EndFunc   ;==>_ClipPutFile
Edited by slightly_abnormal

Share this post


Link to post
Share on other sites
52AT

How to save a picture from the clipboard?

Share this post


Link to post
Share on other sites
Zedna

How to save a picture from the clipboard?

You can call direct clipboard API functions:

Func OpenClipboard($hWnd)
    Local $v_ret = DllCall("user32.dll", "int", "OpenClipboard", "hwnd", $hWnd)
    Return $v_ret[0]
EndFunc   ;==>OpenClipboard

Func CloseClipboard()
    Local $v_ret = DllCall("user32.dll", "int", "CloseClipboard")
    Return $v_ret[0]
EndFunc   ;==>CloseClipboard

Func IsClipboardFormatAvailable($CB_Format)
    Local $v_ret = DllCall("user32.dll", "int", "IsClipboardFormatAvailable", "int", $CB_Format)
    Return $v_ret[0]
EndFunc   ;==>IsClipboardFormatAvailable

Func GetClipboardData($CB_Format)
    Local $v_ret = DllCall("user32.dll", "int", "GetClipboardData", "int", $CB_Format)
    Return $v_ret[0]
EndFunc   ;==>GetClipboardData

For example of use see here:

http://www.autoitscript.com/forum/index.ph...st&p=213739

for more examples search in forum for "OpenClipboard"

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
Sign in to follow this  

×