 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Sat Aug 11, 2007 4:00 am Post subject: Peeking DragDrop & Clipboard Data |
|
|
It'll peek the data, especially (unicode)text, of the DragDrop & Clipboard data.
BTW, the length of the text will be limited to 1023 bytes, but it can be easily circumvented using other string-related APIs, so I'll leave it to the users.
And, it may be combined with any HexViewer script as a full DragDrop/Clipboard data viewer.
To see the contents of the DragDrop, just drag and drop the source to the GUI.
And, press the hotkey #c to see the content of the current clipboard.
DOWNLOAD DragDrop.ahk.
Last edited by Sean on Tue Aug 21, 2007 4:13 am; edited 2 times in total |
|
| Back to top |
|
 |
g11414 Guest
|
Posted: Sat Aug 11, 2007 6:17 am Post subject: |
|
|
Thanks for sharing!  |
|
| Back to top |
|
 |
Hardeep
Joined: 02 Jul 2006 Posts: 87
|
Posted: Sat Aug 11, 2007 9:20 am Post subject: |
|
|
Very useful Thanks for sharing your work. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Sat Aug 11, 2007 11:35 am Post subject: |
|
|
Thanks guys!
I updated the script a little to detect unicode strings as possible as it can using Window's provided API. |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Sat Aug 11, 2007 3:41 pm Post subject: |
|
|
| Fantastic! Thanks for figuring it out. Your script got into my list of favorite tools. |
|
| Back to top |
|
 |
skrommel
Joined: 30 Jul 2004 Posts: 190
|
Posted: Tue Apr 01, 2008 5:04 pm Post subject: |
|
|
A wish come true! Almost...
It crashes AutoHotkey when copying something from Internet Explorer, or it takes a break before continuing. Any ideas?
Skrommel _________________ www.1HourSoftware.com |
|
| Back to top |
|
 |
soggos
Joined: 27 Mar 2008 Posts: 129 Location: France
|
Posted: Fri Mar 19, 2010 10:50 am Post subject: but more great 1023 ¿ |
|
|
Dear Sean,Very Great Now i can drop a link on my gui...
| skrommel wrote: |
It crashes AutoHotkey when copying something from Internet Explorer, or it takes a break before continuing. Any ideas?
Skrommel |
At this time, soggos have no problem with ie8, to recover a link.
But, for all text...
| Sean wrote: | | ... the length of the text will be limited to 1023 bytes, but it can be easily circumvented using other string-related APIs, so I'll leave it to the users.... |
how to retrieve sData (no limit but all)?
cause i have remplaced 1023 with nSize:
| Code: | IEnumFormatEtc(this)
{
LV_Delete()
DllCall(NumGet(NumGet(1*this)+32),"Uint",this,"Uint",1,"UintP",penum) ; DATADIR_GET=1, DATADIR_SET=2
Loop
{
VarSetCapacity(FormatEtc,20,0)
If DllCall(NumGet(NumGet(1*penum)+12), "Uint", penum, "Uint",1, "Uint", &FormatEtc, "Uint",0)
Break
0+(nFormat:=NumGet(FormatEtc,0,"Ushort"))<18 ? RegExMatch("CF_TEXT CF_BITMAP CF_METAFILEPICT CF_SYLK CF_DIF CF_TIFF CF_OEMTEXT CF_DIB CF_PALETTE CF_PENDATA CF_RIFF CF_WAVE CF_UNICODETEXT CF_ENHMETAFILE CF_HDROP CF_LOCALE CF_DIBV5", "(?:\w+\s+){" . nFormat-1 . "}(?<FORMAT>\w+\b)", CF_) : nFormat>=0x80&&nFormat<=0x83 ? RegExMatch("CF_OWNERDISPLAY CF_DSPTEXT CF_DSPBITMAP CF_DSPMETAFILEPICT", "(?:\w+\s+){" . nFormat-0x80 . "}(?<FORMAT>\w+\b)", CF_) : nFormat=0x8E ? CF_FORMAT:="CF_DSPENHMETAFILE" : CF_FORMAT:=GetClipboardFormatName(nFormat)
VarSetCapacity(StgMedium,12,0)
If DllCall(NumGet(NumGet(1*this)+12), "Uint", this, "Uint", &FormatEtc, "Uint", &StgMedium)
Continue
If NumGet(StgMedium,0)=1 ; TYMED_HGLOBAL=1
{
hData:=NumGet(StgMedium,4)
pData:=DllCall("GlobalLock", "Uint", hData)
nSize:=DllCall("GlobalSize", "Uint", hData) ; nSize
; VarSetCapacity(sData,1023), DllCall("wsprintf", "str", sData, "str", DllCall("advapi32\IsTextUnicode", "Uint", pData, "Uint", nSize, "Uint", 0) ? "%S" : "%s", "Uint", pData, "Cdecl")
VarSetCapacity(sData,nSize), DllCall("wsprintf", "str", sData, "str", DllCall("advapi32\IsTextUnicode", "Uint", pData, "Uint", nSize, "Uint", 0) ? "%S" : "%s", "Uint", pData, "Cdecl")
DllCall("GlobalUnlock", "Uint", hData)
LV_Add("", A_Index, CF_FORMAT, nSize, sData)
if CF_FORMAT= CF_TEXT ; for putting in clipboard
{
Clipboard:= sData
MsgBox , 4160 , , TEXTE> %sData% ; BUT not ALL!
}
; if CF_FORMAT= UniformResourceLocator ; OK
; MsgBox , 4160 , , %sData%
; if CF_FORMAT= FileNameW ; OK
; MsgBox , 4160 , , %sData%
}
Else RegExMatch("TYMED_NULL TYMED_FILE TYMED_ISTREAM TYMED_ISTORAGE TYMED_GDI TYMED_MFPICT TYMED_ENHMF", "(?:\w+\s+){" . Floor(ln(NumGet(StgMedium)+1)/ln(2)) . "}(?<STGMEDIUM>\w+\b)", TYMED_), LV_Add("", A_Index, CF_FORMAT, "?", TYMED_STGMEDIUM)
DllCall("ole32\ReleaseStgMedium","Uint",&StgMedium)
}
DllCall(NumGet(NumGet(1*penum)+8), "Uint", penum)
LV_ModifyCol()
}
|
But if sData is more great > 1023 he don't giveall!
How to Do? _________________ with ahk, all is different!...<img> |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Fri Mar 19, 2010 12:36 pm Post subject: |
|
|
The limit of 1023 is imposed by wsprintf API itself used in the script. I chose it due to UNICODE text and Binary data. If you only need the (ANSI) text, you may use the following instead.
| Code: | nLen := DllCall("lstrlen", "Uint", pData)
VarSetCapacity(sData, nLen)
DllCall("lstrcpy", "str", sData, "Uint", pData)
|
However, it's prone to crash AHK when applied to Binary Data. So, my recommendation is using UNICODE build of AHK_L and only retrieve the UNICODE text. |
|
| Back to top |
|
 |
soggos
Joined: 27 Mar 2008 Posts: 129 Location: France
|
Posted: Fri Mar 19, 2010 1:15 pm Post subject: |
|
|
Very good for me, thank's again Sean _________________ with ahk, all is different!...<img> |
|
| Back to top |
|
 |
fragman
Joined: 13 Oct 2009 Posts: 1194
|
Posted: Fri May 14, 2010 12:56 pm Post subject: |
|
|
How would one detect if the user is currently dragging a file (without dropping it onto a GUI) ?
Reason is, I'm programming tabs for windows explorer, and would like to be able to toggle to tab under mouse when the user drags a file over it. |
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Mon Aug 30, 2010 6:12 pm Post subject: |
|
|
bump
Thanks for this!
I'm wondering if this could be considered a replacement for ClipSpy??
Anyway, great work  _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
Deo
Joined: 16 May 2010 Posts: 172
|
Posted: Fri Oct 29, 2010 11:00 am Post subject: |
|
|
how can i get notification thet item is dragging over the gui window from this code?
got it
the only problem - current code won't allow multi files dragging, how to fix this? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|