im using this:
#IfWinActive, ahk_class TTOTAL_CMD $#a:: Clipboard = PostMessage, 1075, 2029, , , ahk_class TTOTAL_CMD ClipWait, 1 Return
and want to include filename+extension with
$#+a::
#IfWinActive, ahk_class TTOTAL_CMD $#a:: Clipboard = PostMessage, 1075, 2029, , , ahk_class TTOTAL_CMD ClipWait, 1 Return
I wasn't suggesting it be used for anything; just curious. What's more curious is that the DIB worked with GetDIBits...However, I'm reluctant to use GetDIBits for this, as the documentation says the hBitmap should be DDB with G(S)etDIBits.
That's a rather backwards-named function... Create(DDBfrom)DIBitmap :roll:. I would think GetObject is more suitable, since it retains the original format of the image. The editor (whatever you're going to paste the image into) isn't necessarily going to be the same format as the screen.PS. Maybe converting to DDB is a better choice, using BitBlt or alike, which is equally applicable for any value of bpp. Even in case of bpp>8, using CreateDIBitmap appears simpler.
As a matter of fact, there isn't anything GetDIBits has to do additionally in case of DIB. All is already there, so what it has to do is merely something similar to GetObject with DIBSECTION. So it may be only a matter of adding an additional check whether it's DIB or DDB.What's more curious is that the DIB worked with GetDIBits...
I agree Window's GDI functions appear somewhat as a mess. Maybe of historical origin/constraint. BTW, I regard Bitmap in the name of GDI functions as DDB. Create(From)DIB(ToB)itmap.That's a rather backwards-named function... Create(DDBfrom)DIBitmap :roll:.
Maybe you want is:it copies the path in text of the selected dir/folder. i want this hotkey to include filename.ext with shift added.
PostMessage, 1075, 2018, , , ahk_class TTOTAL_CMD
; Select the text yourself, then use this shortcut ^n:: clipboard = ; Start off empty to allow ClipWait to detect when the text has arrived. Send ^c ClipWait ; Wait for the clipboard to contain text. FileToClipboard(clipboard) return ;Select all the path in a typical execute dialog or open file dialog ^b:: clipboard = ; Send {AppsKey}{a} Send ^c ClipWait FileToClipboard(clipboard) return ;path := "F:\boo.txt" ;FileToClipboard(path) FileToClipboard(PathToCopy) { ; Expand to full paths: Loop, Parse, PathToCopy, `n, `r Loop, %A_LoopField%, 1 temp_list .= A_LoopFileLongPath "`n" PathToCopy := SubStr(temp_list, 1, -1) ; Allocate some movable memory to put on the clipboard. ; This will hold a DROPFILES struct and a null-terminated list of ; null-terminated strings. ; 0x42 = GMEM_MOVEABLE(0x2) | GMEM_ZEROINIT(0x40) hPath := DllCall("GlobalAlloc","uint",0x42,"uint",StrLen(PathToCopy)+22) ; Lock the moveable memory, retrieving a pointer to it. pPath := DllCall("GlobalLock","uint",hPath) NumPut(20, pPath+0) ; DROPFILES.pFiles = offset of file list pPath += 20 ; Copy the list of files into moveable memory. Loop, Parse, PathToCopy, `n, `r { DllCall("lstrcpy","uint",pPath+0,"str",A_LoopField) pPath += StrLen(A_LoopField)+1 } ; Unlock the moveable memory. DllCall("GlobalUnlock","uint",hPath) DllCall("OpenClipboard","uint",0) ; Empty the clipboard, otherwise SetClipboardData may fail. DllCall("EmptyClipboard") ; Place the data on the clipboard. CF_HDROP=0xF DllCall("SetClipboardData","uint",0xF,"uint",hPath) DllCall("CloseClipboard") }
I'd love to know how to CUT a file to clipboard as well...
DropEffectHex = 020000 ; "020000" is cut "050000" is copy Hex2Bin(DropEffect,DropEffectHex) SetClipboardData("Preferred DropEffect",DropEffect,3,false)
FileToClipboard(PathToCopy,Method="copy") { Loop,Parse,PathToCopy,`n,`r { Loop,%A_LoopField%,1 { temp_list .= A_LoopFileLongPath "`n" } } PathToCopy := SubStr(temp_list,1,-1) hPath := DllCall("GlobalAlloc","uint",0x42,"uint",StrLen(PathToCopy)+22) pPath := DllCall("GlobalLock","uint",hPath) NumPut(20,pPath+0) pPath += 20 Loop,Parse,PathToCopy,`n,`r { DllCall("lstrcpy","uint",pPath+0,"str",A_LoopField) pPath += StrLen(A_LoopField)+1 } DllCall("GlobalUnlock","uint",hPath) DllCall("OpenClipboard","uint",0) DllCall("EmptyClipboard") DllCall("SetClipboardData","uint",0xF,"uint",hPath) mem := DllCall("GlobalAlloc","UInt",2,"UInt",4) str := DllCall("GlobalLock","UInt",mem) if Method=copy DllCall("RtlFillMemory","UInt",str,"UInt",1,"UChar",0x05) else if Method=cut DllCall("RtlFillMemory","UInt",str,"UInt",1,"UChar",0x02) else { DllCall("CloseClipboard") return } DllCall("RtlZeroMemory","UInt",str + 1,"UInt",1) DllCall("RtlZeroMemory","UInt",str + 2,"UInt",1) DllCall("RtlZeroMemory","UInt",str + 3,"UInt",1) DllCall("GlobalUnlock","UInt",mem) cfFormat := DllCall("RegisterClipboardFormat","Str","Preferred DropEffect") DllCall("SetClipboardData","UInt",cfFormat,"UInt",mem) DllCall("CloseClipboard") return }