![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Shell.Application/copyTo(): confirmAll option Hi there I use the Shell.Application's copyTo command to copy files into a Zip-Archive. I don't want to blame the user with prompts and questions therefore I use the option ConfirmAllWithYes(16, as the documentation says). However, it copies the files well, but if the destination Archive does contain a file with the same name as I want to copy, the user gets a prompt, even I use the ConfirmAllWithYes option. Here's the script: Set oApp = CreateObject("Shell.Application") oApp.Namespace("c:\myArchive.zip").copyHere "c:\anyOtherFile.txt", 16 Set oApp = Nothing Does anyone has an Idea how to get it work? Or is that a bug?? Thank you for answers and best regards Patrick |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Shell.Application/copyTo(): confirmAll option Luegisdorf wrote: Quote: > Hi there > > I use the Shell.Application's copyTo command to copy files into a > Zip-Archive. I don't want to blame the user with prompts and questions > therefore I use the option ConfirmAllWithYes(16, as the documentation says). > > However, it copies the files well, but if the destination Archive does > contain a file with the same name as I want to copy, the user gets a prompt, > even I use the ConfirmAllWithYes option. > > Here's the script: > > Set oApp = CreateObject("Shell.Application") > oApp.Namespace("c:\myArchive.zip").copyHere "c:\anyOtherFile.txt", 16 > Set oApp = Nothing > > Does anyone has an Idea how to get it work? Or is that a bug?? > > Thank you for answers and > best regards > Patrick > As best I can make out, the webpage you are referring to is using System.Shell.Folder.copyHere(oItem [, intOptions]) rather than "Shell.Application". Shell.Appication is provided by "various" dll's (different dll's for different systems), whereas System.Shell... is provided by the net framework. While various net framework objects (System.XXX) appear to have COM interfaces, and so may be instantiated from script, System.Shell does _not_ appear to be one of them (at least on my system). If I am correct on this then you might try asking your question in a net framework group, or else use the "interop" capability of vb.net to write a scripting interface to System.Shell. cheers, jw ____________________________________________________________ You got questions? WE GOT ANSWERS!!! ..(but, no guarantee the answers will be applicable to the questions) |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Shell.Application/copyTo(): (TAKE 2) Luegisdorf wrote: Quote: > I use the Shell.Application's copyTo command to copy files into a > Zip-Archive. I don't want to blame the user with prompts and questions > therefore I use the option ConfirmAllWithYes(16, as the documentation says). > I think I may have found the answer here: http://www.microsoft.com/technet/scr....mspx?mfr=true The options for the shell.application are not (quite) the same as for system.shell. They are the same constants as are used for flags in the SHFILEOPSTRUCT typedef (you know what that is, right?). Const FOF_MULTIDESTFILES = &H1 Const FOF_CONFIRMMOUSE = &H2 Const FOF_SILENT = &H4 Const FOF_RENAMEONCOLLISION = &H8 Const FOF_NOCONFIRMATION = &H10 Const FOF_WANTMAPPINGHANDLE = &H20 Const FOF_ALLOWUNDO = &H40 Const FOF_FILESONLY = &H80 Const FOF_SIMPLEPROGRESS = &H100 Const FOF_NOCONFIRMMKDIR = &H200 If you look at the technet page mentioned above, you will see that the FOF_NOCONFIRMATION constant is specified slightly differently. It is "&H10&" rather than "&H10" ( <- no trailing "&" ). So, you may ask what is the difference, and how is that different from plain old 16? The difference is this, &H10 is a "short", and &H10& is a "long". Try this: Const FOF_NOCONFIRMATION = &H10& If that doesn't work, I give up. cheers, jw p.s. If all else fails, you could always resort to the "Brute Force" approach. That is, do an inventory (using FSO) of both folders, and then simply delete the duplicate files in the destination folder before doing your copy. An even more outrageous solution would be to use "system hooking". A "CBT" hook allows you to receive a notification for each new window that opens. If the window is one of those confirmation dialogs, then you just send it a mouse click message to dismiss it. But as you probably know, this will require using some other language than vbs. vb (classic) will do, as well as one of the other scripting languages that allows for calling the system api. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Shell.Application/copyTo(): confirmAll option Eric gave me the answer under another thread called "CopyHere" If you want to specify more than one at a time, you don't pass them as separate parameters. You have to combine them. If you want option 8 and option 16 you pass value 24 not 8,16. This is why the option values are multiplied numbers James "Luegisdorf" <Luegisdorf@xxxxxx> wrote in message news:386829A2-29C2-4A1C-B35A-CE6810E09BD9@xxxxxx Quote: > Hi there > > I use the Shell.Application's copyTo command to copy files into a > Zip-Archive. I don't want to blame the user with prompts and questions > therefore I use the option ConfirmAllWithYes(16, as the documentation > says). > > However, it copies the files well, but if the destination Archive does > contain a file with the same name as I want to copy, the user gets a > prompt, > even I use the ConfirmAllWithYes option. > > Here's the script: > > Set oApp = CreateObject("Shell.Application") > oApp.Namespace("c:\myArchive.zip").copyHere "c:\anyOtherFile.txt", 16 > Set oApp = Nothing > > Does anyone has an Idea how to get it work? Or is that a bug?? > > Thank you for answers and > best regards > Patrick > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| shell.application | VB Script | |||
| Shell.Application copy problems | VB Script | |||
| can shell.application do this? | PowerShell | |||
| Shell.Application Open method doesn't seem to | VB Script | |||
| problem with shell.application | PowerShell | |||