|
|
|
| 8 August 2002 | GUICopy() |
| Author | Chris S. |
| Action | Uses the Shell Object to copy or move files/folders. Displays the animated 'Copying Files' progress dialog as files/folders are being copied. |
| Syntax | GUICopy ("Command", "Source", "Destination", optional FLAGS) |
| Parameters | |
| Remarks | Originally posted at: http://kixtart.org/cgi-bin/Ultimatebb.cgi KiX 4.02 (or higher); Shell32.dll version 4.71 or later. (Included with: Windows 2000, Windows NT 4.0; with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0.) |
| Returns | The exitcode of the command in the @error macro. @error = 0 - Successful copy/move @error = 1 - Source does not exist @error = 2 - Destination does not exist @error = 3 - Cannot create namespace. Incorrect Shell32.dll version. @error = 4 - Incorrect syntax. Use "Copy" or "Move" |
| Dependencies | None. |
| Examples |
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.
; Copy all KiX files in 'C:\' to 'E:\':
GUICopy("Copy", "C:\*.kix", "E:\")
? "Exit Code: " @error
Copy all KiX files in 'C:\' to 'E:\', but do not overwrite. Instead, make a new copy of the files:
GUICopy("Copy", "C:\*.kix", "E:\", 8)
? "Exit Code: " @error
Copy a folder in 'C:\KiXScripts' to 'E:\'
GUICopy("Copy", "C:\KiXScripts", "E:\")
? "Exit Code: " @error
; Move the folder in 'C:\KiXScripts' to 'E:\'
GUICopy("Move", "C:\KiXScripts", "E:\")
? "Exit Code: " @error
|
| Source |
FUNCTION GUICopy ($cmd, $source, $destination, OPTIONAL $flags)
IF NOT $flags
$flags=0
ENDIF
IF NOT Exist($source)
BEEP ? "Source does not exist."
EXIT (1)
ENDIF
IF NOT Exist($destination)
BEEP ? "Destination does not exist."
EXIT (2)
ENDIF
$objshell=CreateObject("Shell.Application")
$objfolder=$objshell.namespace($destination)
IF NOT $objfolder
BEEP ? "Cannot create namespace. Incorrect Shell32.dll version."
EXIT (3)
ENDIF
SELECT
CASE $cmd="Copy"
$objfolder.copyhere($source, $flags)
CASE $cmd="Move"
$objfolder.movehere($source, $flags)
CASE 1
BEEP ? "GUICopy Syntax Incorrect. Use COPY or MOVE."
$objshell=0
EXIT (4)
ENDSELECT
$objshell=0
EXIT @error
ENDFUNCTION ; - GUICopy -
|
|
|
|