carpediem Posted March 3, 2006 Share Posted March 3, 2006 (edited) EDIT: Can't seem to edit the topic... Unzipping is, of course, what I meant. Hi! Trying to copy some files from a zip archive using the CopyHere method. Here's what Microsoft says about the method. Folder.CopyHere(vItem [, vOptions]) vItem Required. Specifies the item or items to copy. This can be a string that represents a file name, a FolderItem object, or a FolderItems object. vOptions Optional. Specifies options for the copy operation. This value can be zero or a combination of the following values. These values are based upon flags defined for use with the fFlags member of the C++ SHFILEOPSTRUCT structure. These flags are not defined as such for Microsoft Visual Basic, Visual Basic Scripting Edition (VBScript), or Microsoft JScript, so you must define them yourself or use their numeric equivalents.4 Do not display a progress dialog box. 8 Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists. 16 Respond with "Yes to All" for any dialog box that is displayed. 64 Preserve undo information, if possible. 128 Perform the operation on files only if a wildcard file name (*.*) is specified. 256 Display a progress dialog box but do not show the file names. 512 Do not confirm the creation of a new directory if the operation requires one to be created. 1024 Do not display a user interface if an error occurs. 2048 Version 4.71. Do not copy the security attributes of the file. 4096 Only operate in the local directory. Don't operate recursively into subdirectories. 9182 Version 5.0. Do not copy connected files as a group. Only copy the specified files. This is how my function looks like right now (no error checking and such yet. The problem I have is that I can't seem to get the flags working. Func unzipIt($sPath,$dPath) $objShell = ObjCreate("Shell.Application"); $SrcFldr = $objShell.NameSpace($sPath) $DestObj = $objShell.NameSpace($dPath) $FldrItems = $SrcFldr.Items $DestObj.CopyHere($FldrItems, 16) EndFunc the flag 16 is supposed to respond with a "yes to all" in case a file already exists, but the problem for me is that I still see the dialog to overwrite. Am I using the flags wrong, or is there a problem somewhere else? Edited March 3, 2006 by carpediem Link to comment Share on other sites More sharing options...
carpediem Posted March 8, 2006 Author Share Posted March 8, 2006 Anyone that have gotten the flags to work? Link to comment Share on other sites More sharing options...
Valuater Posted March 8, 2006 Share Posted March 8, 2006 i dont think so... but there may be some more stuff here for you to look athttp://www.autoitscript.com/forum/index.ph...pic=21004&st=0#8) Link to comment Share on other sites More sharing options...
Joon Posted March 8, 2006 Share Posted March 8, 2006 Func unzipIt($sPath,$dPath) $objShell = ObjCreate("Shell.Application"); $SrcFldr = $objShell.NameSpace($sPath) $DestObj = $objShell.NameSpace($dPath) $FldrItems = $SrcFldr.Items $DestObj.CopyHere($FldrItems, 16) EndFunc the flag 16 is supposed to respond with a "yes to all" in case a file already exists, but the problem for me is that I still see the dialog to overwrite. Am I using the flags wrong, or is there a problem somewhere else? hmm... your code works fine on my Windows 2003 server. I don't get any dialog and if I delete option, i get confirmation dialog. unzipIt("c:\test1","c:\test2") Func unzipIt($sPath,$dPath) $objShell = ObjCreate("Shell.Application"); $SrcFldr = $objShell.NameSpace($sPath) $DestObj = $objShell.NameSpace($dPath) $FldrItems = $SrcFldr.Items $DestObj.CopyHere($FldrItems,16) EndFunc Link to comment Share on other sites More sharing options...
Gigglestick Posted March 8, 2006 Share Posted March 8, 2006 Nice code. I get the overwrite prompt on my XP SP2 box. My UDFs: ExitCodes Link to comment Share on other sites More sharing options...
carpediem Posted March 9, 2006 Author Share Posted March 9, 2006 Wierd... Why is 2003 server and XP SP2 act different on this? Anyone have a clue? I already saw the other topic, but that does not cover flags at all. 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