Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy like Explorer ( using Explorer )
Message
From
21/10/1999 09:33:08
 
 
To
21/10/1999 09:22:19
Cristian Tenea
Aquila Part Prod Com
Ploiesti, Romania
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00278035
Message ID:
00279256
Views:
16
>>Shell.Application is fully supported for anything with Shell32.DLL version 4.71 or later, including Win98se
>
>On my system - NT4.0wks sp4 with Ie4.0 sp1 - version of shell32.dll is 4.0 and code works.
>
>>NameSpace is a METHOD not a property, and the return from invoking Shell.Application's NameSpace method will be a folder object for the vDir argument. If vDir doesn't exist, or isn't a valid folder (for example, a domain or a nonexistant directory) then the NameSpace method can't return a folder object. You must specify a value for the vDir, and must test the return type to make sure its an object.
>
>I supply a value for vDir that is sure valid.
>
>I use this:
>
>winfile=createobject("Shell.Application") && on systems without IE4 get error class not registered but not in Win98se
>fileto="c:\folder1\file1.ext" && folder exist but file no

Your error is here - the destination must exist and be a valid folder. The following sample of code works just fine:

ox=createobj('shell.application')
md c:\test1
cx = getf()
ox.namespace('c:\test1').CopyHere(cx)

If you need to rename files during the copy, use the Scripting.FileSystemObject which is a part of WSH, or use CopyHere as I showed above, get a FolderItem back from NameSpace using either the Items collection or the ParseName method for the copied file and use the FolderItem's Name property to rename it.

>filefrom="x:\folderx\file1.ext" && folder and file exist
>winfile.namespace(fileto).copyhere(filefrom) && on win98se namespace is not object
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform