sc4ry Posted March 10, 2009 Share Posted March 10, 2009 Hey, i did a little app which gets all text data from clipboard an put that into a listview, where you can easyly get this back,when you need it again. the next step is, that, when user put a file into the clipboard, this should also be shown with name (and maybe) path in the listview and when you click this, this file will be in clipboard again. when this ist not possible, at least filename and path should be in clipboard. is that possible? Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 10, 2009 Share Posted March 10, 2009 Hey,i did a little app which gets all text data from clipboard an put that into a listview, where you can easyly get this back,when you need it again.the next step is, that, when user put a file into the clipboard, this should also be shown with name (and maybe) path in the listview and when you click this, this file will be in clipboard again.when this ist not possible, at least filename and path should be in clipboard.is that possible?Try the example scripts for all the _Clipboard* functions in the help file to get a feel for what you do with the various formats. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ProgAndy Posted March 10, 2009 Share Posted March 10, 2009 (edited) I have an example (most is from DragDrop ): But only copy works. cut/shortcut don't work.expandcollapse popup#include<Memory.au3> #include<ClipBoard.au3> Global Const $DROPFILES = "DWORD pFiles; int pt[2]; int fNC; int fWide;" ;=============================================================================== ; ; Function Name: _CreateDROPFILES ; Description:: Creates a DROPFILES-structure ; Parameter(s): $Files - Pipe-separated list of files to copy: example: C:\File1.bin|D:\AnotherFile.dat ; Requirement(s): COM/OLE UDF ; Return Value(s): HGLOBAL-Pointer to a DROPFILES structure ; Author(s): prog@ndy ; ;=============================================================================== ; Func _CreateDROPFILES($Files) $Files = String($Files) $hMem = _MemGlobalAlloc(_DragDrop_SIZEOF($DROPFILES) + ((StringLen($Files)+2)*2),$GPTR) $Files = StringSplit($Files,"|") $stDROPFILES = DllStructCreate($DROPFILES,$hMem) $hPtr = $hMem + DllStructGetSize($stDROPFILES) DllStructSetData($stDROPFILES, "fWide", 1) DllStructSetData($stDROPFILES, 1, DllStructGetSize($stDROPFILES)) For $i = 1 To $Files[0] $next = DllStructCreate("wchar[" & StringLen($Files[$i])+1 & "]", $hPtr) DllStructSetData($next,1,$Files[$i] & ChrW(0)) $hPtr += (StringLen($Files[$i])+1)*2 Next $next = DllStructCreate("wchar[1]", $hPtr) DllStructSetData($next,1,ChrW(0)) Return $hMem EndFunc ; Prog@ndy Func _CreatePREFERREDDROPEFFECT($dwEffect) Local $pMem = _MemGlobalAlloc(4, $GHND) ; 4 bytes - 1 DWORD If Not $pMem Then Return SetError(1,0,0) DllStructSetData(DllStructCreate("DWORD",$pMem),1,$dwEffect) Return $pMem EndFunc ; Author: Prog@ndy Func _DragDrop_SIZEOF($tagStruct) Return DllStructGetSize(DllStructCreate($tagStruct, 1)) EndFunc ;==>_DragDrop_SIZEOF Global Const $CFSTR_PREFERREDDROPEFFECT = "Preferred DropEffect" Global Const $CF_PREFERREDDROPEFFECT = _ClipBoard_RegisterFormat($CFSTR_PREFERREDDROPEFFECT) Global Const $DROPEFFECT_NONE = 0 Global Const $DROPEFFECT_COPY = 1 Global Const $DROPEFFECT_MOVE = 2 Global Const $DROPEFFECT_LINK = 4 Global Const $DROPEFFECT_SCROLL = 0x80000000 $hGUI = GUICreate("") $hClip = _ClipBoard_Open($hGUI) _ClipBoard_Empty() $Files = "C:\file.txt" $HDROP = _CreateDROPFILES($Files) $DROPEFFECT = _CreatePREFERREDDROPEFFECT($DROPEFFECT_COPY) _ClipBoard_SetDataEx($HDROP, $CF_HDROP) _ClipBoard_SetDataEx($DROPEFFECT, $CF_PREFERREDDROPEFFECT) _ClipBoard_Close()//Edit: get files from Clipboard works like WM_DROPFILES for DragDrop http://www.autoitscript.com/forum/index.ph...c=90831&hl=(get data from clipboardformat $CF_HDROP and use the same funcs as in WM_DROPFILES to get the files.) Edited March 10, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
KaFu Posted March 25, 2010 Share Posted March 25, 2010 Searched for ages for something like this, great work ... found you're addition on the German board about file moving and added it to this example. Use $DROPEFFECT = _CreatePREFERREDDROPEFFECT($DROPEFFECT_COPY) to copy and $DROPEFFECT = _CreatePREFERREDDROPEFFECT($DROPEFFECT_MOVE) to move files. expandcollapse popup; ProgAndy ; http://www.autoitscript.com/forum/index.php?showtopic=91046&view=findpost&p=654849 ; http://www.autoit.de/index.php?page=Thread&postID=81909&highlight=hdrop#post81909 #include<Memory.au3> #include<ClipBoard.au3> Global Const $DROPFILES = "DWORD pFiles; int pt[2]; int fNC; int fWide;" ;=============================================================================== ; ; Function Name: _CreateDROPFILES ; Description:: Creates a DROPFILES-structure ; Parameter(s): $Files - Pipe-separated list of files to copy: example: C:\File1.bin|D:\AnotherFile.dat ; Requirement(s): COM/OLE UDF ; Return Value(s): HGLOBAL-Pointer to a DROPFILES structure ; Author(s): prog@ndy ; ;=============================================================================== ; Func _CreateDROPFILES($Files) $Files = String($Files) $hMem = _MemGlobalAlloc(_DragDrop_SIZEOF($DROPFILES) + ((StringLen($Files)+2)*2),$GPTR) $Files = StringSplit($Files,"|") $stDROPFILES = DllStructCreate($DROPFILES,$hMem) $hPtr = $hMem + DllStructGetSize($stDROPFILES) DllStructSetData($stDROPFILES, "fWide", 1) DllStructSetData($stDROPFILES, 1, DllStructGetSize($stDROPFILES)) For $i = 1 To $Files[0] $next = DllStructCreate("wchar[" & StringLen($Files[$i])+1 & "]", $hPtr) DllStructSetData($next,1,$Files[$i] & ChrW(0)) $hPtr += (StringLen($Files[$i])+1)*2 Next $next = DllStructCreate("wchar[1]", $hPtr) DllStructSetData($next,1,ChrW(0)) Return $hMem EndFunc ; Prog@ndy Func _CreatePREFERREDDROPEFFECT($dwEffect) Local $pMem = _MemGlobalAlloc(4, $GPTR) ; 4 bytes - 1 DWORD If Not $pMem Then Return SetError(1,0,0) DllStructSetData(DllStructCreate("DWORD",$pMem),1,$dwEffect) Return $pMem EndFunc ; Author: Prog@ndy Func _DragDrop_SIZEOF($tagStruct) Return DllStructGetSize(DllStructCreate($tagStruct, 1)) EndFunc ;==>_DragDrop_SIZEOF Global Const $CFSTR_PREFERREDDROPEFFECT = "Preferred DropEffect" Global Const $CF_PREFERREDDROPEFFECT = _ClipBoard_RegisterFormat($CFSTR_PREFERREDDROPEFFECT) Global Const $DROPEFFECT_NONE = 0 Global Const $DROPEFFECT_COPY = 1 Global Const $DROPEFFECT_MOVE = 2 Global Const $DROPEFFECT_LINK = 4 Global Const $DROPEFFECT_SCROLL = 0x80000000 $hGUI = GUICreate("") $hClip = _ClipBoard_Open($hGUI) _ClipBoard_Empty() $Files = @ScriptDir & "\test.txt" $HDROP = _CreateDROPFILES($Files) ;$DROPEFFECT = _CreatePREFERREDDROPEFFECT($DROPEFFECT_COPY) $DROPEFFECT = _CreatePREFERREDDROPEFFECT($DROPEFFECT_MOVE) _ClipBoard_SetDataEx($HDROP, $CF_HDROP) _ClipBoard_SetDataEx($DROPEFFECT, $CF_PREFERREDDROPEFFECT) _ClipBoard_Close() OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now