Hi Chip, Below is for everyone's information and the Python function/procedure format is the def statement and if a function it just uses the return statement. Remember that in Python there are no end statements, just indentation is used. Also, the start of a block a : character is used at the end of the statement. Below the statement used to get C++ code is CTypes and all or most code is in lowercase and is case sensitive. Also comments are either 3 quotes, a number sign or just one line a single quote as is the #
def getPasteFiles( Files ): "Get File List and Below Are Value Descriptions." #ctypes.windll.user32. #Insure desired format is there, and open clipboard. if ctypes.windll.user32.IsClipboardFormatAvailable( CF_HDROP): if ctypes.windll.user32.OpenClipboard(0): #Get handle to Dropped Filelist data, and number of files. hDrop = ctypes.windll.user32.GetClipboardData( CF_HDROP) num_files = shell.DragQueryFile(hDrop, -1) #Files array: files= [] #xrange means by default 0 to length: for i in xrange(num_files): fpath= shell.DragQueryFile( hDrop, i) files.append(fpath) return files So remember the above code is indent and lower case sensitive. There is an easy way to do it in vb But, this could easily be added into the we clipboard object model for people to be able to select files, copy them on the clipboard, then paste the list in a document or other lists without having to actually copy the file itself. There are codes for type of option in using this and there cf_ codes and 15 is for dropfiles, and 1 is for text only, easy to get and use. Bruce Sent: Thursday, July 25, 2013 5:15 PM Subject: Re: Can We Call Win32 and shell? Hi Chip, I know how to get files the normal way and someone , besides myself, wanted to get the file list from the clipboard. I have written a version in Python and could write it using studio, but just was asking about using .vbs to get the win32 object which is needed. The only way to get the file list from the clipboard is using shell and that is actually the easy part of getting the file list, in fact very easy. The only other problem is getting into the clipboard commands and that has to be done by win32 commands and Windoweyes does not allow that, they only give properties and 1 method, append They could easily add isFiles and the object they use for the clipboard itself, for they have to be using it for the few options they have, the only thing missing is the object itself. Now there are memory management calls and such, all under the win32 clipboard command for they use open() and all the other functions. The way to get the file list is to call the shell command: shell.DragDropFile for that is the only way to get the files... So, the only thing I need is the actual clipboard object being used at the window level. Having this feature makes things a lot easier and fast and not requiring another app if it were built into the WE object model. I added another property, pasteFileNames in my code... Bruce Sent: Thursday, July 25, 2013 4:20 PM Subject: RE: Can We Call Win32 and shell? It's not quite clear to me what you really need Bruce, but below is an example of how to get the list of files for a given dir in VBScript: set x=getfiles("c:\temp") ' X now holds a dictionary of file names, with the index being an integer number starting at 1 Function getFiles(ForDir) Dim fsObj Dim folder Dim file Dim fileList dim i Set getFiles = Nothing Set fileList = CreateObject("scripting.dictionary") Set fsObj = CreateObject("Scripting.FileSystemObject") If fsObj.FolderExists(ForDir) Then Set folder = fsObj.GetFolder(ForDir) i=0 For Each file In folder.Files i=i+1 fileList.Add i, file.name Next Set getFiles = fileList End If End Function From: BX [mailto:bronx_...@fltg.net] Sent: Thursday, July 25, 2013 9:32 AM To: gw-scripting@gwmicro.com Subject: Can We Call Win32 and shell? Can we call win32 and shell commands directly using an object create method in vb? I have developed a program to extract file names from the clip board and you can display them as an array or iterate through the array list since the call back method is an array... So I need to have win32 and shell in order to get the clipboard handle then get the DragQueryFile method from the shell because files are on the system and have to be extracted from the shell. So, I would like to know how to get that object for the shell and win32. Could I get the clipboard object without using win32? Since the clipboard command you have is only for text and someone a while back wanted to get file names, so I can do that now if I have the way of getting the shell object from the system without doing the other shell object; yet I may have answered my question, but still want ideas. Bruce