Показать полную графическую версию : [решено] Отображение процесса перемещения файлов
Подскажите как можно сделать отображение процесса перемещения файлов, пробовал через GuiCtrlCreateAvi + файл avi , но видео не воспроизводится а отображается как статическая картинка пытался найти аналогичное видео через shell32 но не нашол. Собственно нужно лишь постоянное воспроизвидение видео до завершения процесса перемещения
как можно сделать отображение процесса перемещения файлов »
FilesCopyProgress UDF (http://autoit-script.ru/index.php?action=downloads;sa=view;down=14)
Для перемещения можно приспособить удалив файл по окончанию копирования :)
а как можно сделать видео(анимация) как в проводнике Windows при копировании/перемещении(документы летают из папки в папку) ?
shell32.dll -> AVI -> 161
GUICtrlCreateAvi(@SystemDir & "\shell32.dll", 161, 50, 10)
Да картинка появилась но не поспроизводится почемуто
GUISetState($avi,1)
GUISetState($avi,0)
Добавление $ACS_AUTOPLAY в GUICtrlCreateAvi(@SystemDir & "\shell32.dll", 161, 50, 10) не помогло. мож я туплю
FlatX007
29-01-2010, 12:00
Вытаскивый ResHacker`ом AVI ролик из shell32.dll ... и прописывай действительный путь до ролика. У меня тоже не работает.
Сохраннённый AVI ролик - 28Кб, только у меня почему-то розовый фон там где папки летают :)
вытащил - прописал но не воспроизводит :(, показывает как картинку :
$avi = GUICtrlCreateAvi("c:\161.avi",-1,1,1,$ACS_AUTOPLAY)
GUISetState($avi,1)
Filemove("c:\1\*.*","d:\1\")
GUISetState($avi,0)
Попробовал заменить Filemove("c;\1\*.*","d:\1\") на Sleep(20000) всё нормально проигрывает. Попробовал сделать Filemove("c;\1\*.*","d:\1\") через функцию всеравно не воспроизводит :(
FlatX007
29-01-2010, 12:29
Не то видео вытащил ... :) - 165 надо.
от номера видео суть не меняется, видео не воспроизводится а показывает как статическое изображение:
$avi = GUICtrlCreateAvi("c:\161.avi",-1,1,1,$ACS_AUTOPLAY)
GUISetState($avi,1)
Filemove("c:\1\*.*","d:\1\")
GUISetState($avi,0)
Попробовал заменить Filemove("c;\1\*.*","d:\1\") на Sleep(20000) всё нормально проигрывает. Попробовал сделать Filemove("c;\1\*.*","d:\1\") через функцию всеравно не воспроизводит :(
FlatX007
29-01-2010, 12:56
Значит нужно 2 скрита - один копирует другой воспроизводит avi ролик.
как можно сделать видео(анимация) как в проводнике Windows при копировании/перемещении(документы летают из папки в папку) ? »
Как вариант, вытащить из видео кадры, и менять их в callback-функций __FCSP_ProgressRoutine используя глобальный счётчик.
Ну или можно совсем использовать перемещение файлов с отображением системного диалога:
#Region consts
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOR_MOVE = 0x0001
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOR_COPY = 0x0002
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOR_DELETE = 0x0003
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOR_RENAME = 0x0004
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_MULTIDESTFILES = 0x0001
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_CONFIRMMOUSE = 0x0002
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_SILENT = 0x0004
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_RENAMEONCOLLISION = 0x0008
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_NOCONFIRMATION = 0x0010
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_WANTMAPPINGHANDLE = 0x0020
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_ALLOWUNDO = 0x0040
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_FILESONLY = 0x0080
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_SIMPLEPROGRESS = 0x0100
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_NOCONFIRMMKDIR = 0x0200
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_NOERRORUI = 0x0400
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_NOCOPYSECURITYATTRIBS = 0x0800
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_NORECURSION = 0x1000
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_NO_CONNECTED_ELEMENTS = 0x2000
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_WANTNUKEWARNING = 0x4000
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) Const (http://www.autoitscript.com/autoit3/docs/keywords.htm#Const) $FOF_NORECURSEREPARSE = 0x8000
#Endregion consts
;
$iFlags = BitOR (http://www.autoitscript.com/autoit3/docs/functions/BitOR.htm)($FOF_FILESONLY, $FOF_ALLOWUNDO, $FOF_RENAMEONCOLLISION, $FOF_NOCONFIRMMKDIR)
_CopyWithProgress("C:\File.avi", "D:\File.avi", $FOR_MOVE, $iFlags)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) _CopyWithProgress($sFrom, $sTo, $OPERATION_MODE, $GENERAL_MODE)
; version 1 by SumTingWong on 5/26/2006
; http://www.autoitscript.com/forum/index.php?showtopic=11888
; updated by lod3n on 6/5/2007
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $SHFILEOPSTRUCT
Local (http://www.autoitscript.com/autoit3/docs/keywords.htm#Local) $pFrom, $pTo, $aDllRet, $nError = 0
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) FileExists (http://www.autoitscript.com/autoit3/docs/functions/FileExists.htm)($sTo) And (http://www.autoitscript.com/autoit3/docs/keywords.htm#And) StringRight (http://www.autoitscript.com/autoit3/docs/functions/StringRight.htm)($sFrom, 3) <> "*.*" And (http://www.autoitscript.com/autoit3/docs/keywords.htm#And) StringInStr (http://www.autoitscript.com/autoit3/docs/functions/StringInStr.htm)(FileGetAttrib (http://www.autoitscript.com/autoit3/docs/functions/FileGetAttrib.htm)($sFrom), "D") Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) $sFrom &= "\*.*"
$SHFILEOPSTRUCT = DllStructCreate (http://www.autoitscript.com/autoit3/docs/functions/DllStructCreate.htm)("int;uint;ptr;ptr;uint;int;ptr;ptr")
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) @error (http://www.autoitscript.com/autoit3/docs/macros.htm#@error) Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) "nostruct"
; hwnd
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($SHFILEOPSTRUCT, 1, 0)
; wFunc
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($SHFILEOPSTRUCT, 2, $OPERATION_MODE)
; pFrom
$pFrom = DllStructCreate (http://www.autoitscript.com/autoit3/docs/functions/DllStructCreate.htm)("char[" & StringLen (http://www.autoitscript.com/autoit3/docs/functions/StringLen.htm)($sFrom) + 2 & "]")
; pFrom will now be null-terminated at StringLen($sFrom)+1
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($pFrom, 1, $sFrom)
For (http://www.autoitscript.com/autoit3/docs/keywords.htm#For) $i = 1 To (http://www.autoitscript.com/autoit3/docs/keywords.htm#To) StringLen (http://www.autoitscript.com/autoit3/docs/functions/StringLen.htm)($sFrom) + 2
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) DllStructGetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructGetData.htm)($pFrom, 1, $i) = 10 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($pFrom, 1, 0, $i)
Next (http://www.autoitscript.com/autoit3/docs/keywords.htm#Next)
; We need a second null at the end
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($pFrom, 1, 0, StringLen (http://www.autoitscript.com/autoit3/docs/functions/StringLen.htm)($sFrom) + 2)
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($SHFILEOPSTRUCT, 3, DllStructGetPtr (http://www.autoitscript.com/autoit3/docs/functions/DllStructGetPtr.htm)($pFrom))
; pTo
$pTo = DllStructCreate (http://www.autoitscript.com/autoit3/docs/functions/DllStructCreate.htm)("char[" & StringLen (http://www.autoitscript.com/autoit3/docs/functions/StringLen.htm)($sTo) + 2 & "]")
; pTo will now be null-terminated at StringLen($sTo)+1
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($pTo, 1, $sTo)
; We need a second null at the end
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($pTo, 1, 0, StringLen (http://www.autoitscript.com/autoit3/docs/functions/StringLen.htm)($sTo) + 2)
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($SHFILEOPSTRUCT, 4, DllStructGetPtr (http://www.autoitscript.com/autoit3/docs/functions/DllStructGetPtr.htm)($pTo))
; fFlags
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($SHFILEOPSTRUCT, 5, $GENERAL_MODE)
; fAnyOperationsAborted
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($SHFILEOPSTRUCT, 6, 0)
; hNameMappings
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($SHFILEOPSTRUCT, 7, 0)
; lpszProgressTitle
DllStructSetData (http://www.autoitscript.com/autoit3/docs/functions/DllStructSetData.htm)($SHFILEOPSTRUCT, 8, 0)
$aDllRet = DllCall (http://www.autoitscript.com/autoit3/docs/functions/DllCall.htm)("shell32.dll", "int", "SHFileOperation", "ptr", DllStructGetPtr (http://www.autoitscript.com/autoit3/docs/functions/DllStructGetPtr.htm)($SHFILEOPSTRUCT))
$iRetCode = $aDllRet[0]
$pFrom = 0
$pTo = 0
$SHFILEOPSTRUCT = 0
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iRetCode <> 0 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then) Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) SetError (http://www.autoitscript.com/autoit3/docs/functions/SetError.htm)($nError, $iRetCode, False (http://www.autoitscript.com/autoit3/docs/keywords.htm#False))
Return (http://www.autoitscript.com/autoit3/docs/keywords.htm#Return) True (http://www.autoitscript.com/autoit3/docs/keywords.htm#True)
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc) ;==>_CopyWithProgress
Как для решения проблемы подходит, но слишком много буков для решения обычной задачи :(
слишком много буков для решения обычной задачи »
Кто сказал что это обычная задача? копирование, да, задача обычная и тривиальная, а копирование с отображением прогресса, далеко не обычная, требует обработку данных и вывод детальной информаций, отсюда и “многобуков” ;)
думаю вопрос решен, осталось только проверить на работоспособность его в Windows 98 :).
В Windows 98 не работает... :(
В Windows 98 не работает »
А кто сказал что оно должно работать там? AutoIt последних версий больше не поддерживает Win 9x.
Хотя судя по MSDN функция «SHFileOperation» поддерживается даже в Win 95...
P.S
В 3.2.8.1 не пробовал запустить?
хорошо попробую, на версии 3.2.12.1 не захотело
Можно попробывать так:
; Windows - copy with progress
; Author - JdeB
;~ 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.
;~ 8192 Version 5.0. Do not copy connected files as a group. Only copy the specified files.
_FileCopy('D:\Test.tmp', 'C:\')
Func _FileCopy($sFrom, $sTo)
$wShell = ObjCreate('Shell.Application')
$wShell.NameSpace($sTo).CopyHere($sFrom, 128)
EndFunc ;==>_FileCopy
Или можно так:
If $CmdLine[0] Then
Exit FileCopy($CmdLine[1], $CmdLine[2])
EndIf
GUICreate('MyGUI')
$Ani = GUICtrlCreateAvi(@SystemDir & '\shell32.dll', 161, 50, 10)
GUISetState()
GUICtrlSetState($Ani, 1)
$Result = RunWait(@ScriptFullPath & ' "D:\Test.tmp" "C:\"')
If (@error) Or ($Result) Then
MsgBox(16, '', 'Error!')
Else
MsgBox(64, '', 'OK')
EndIf
GUICtrlSetState($Ani, 0)
GUIDelete()
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.