Войти

Показать полную графическую версию : [решено] Autoit


ZmeyRepack
28-08-2021, 12:24
Всем привет снова нужна ваша помощь вот
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Program Files (x86)\koda_1.7.3.0\Forms\Form1.kxf
$Form1_1 = GUICreate("Form1", 532, 110, 192, 124)
$Button1 = GUICtrlCreateButton("Folder№1", 8, 8, 75, 25)
$Button2 = GUICtrlCreateButton("Folder№2", 8, 40, 75, 25)
$Input1 = GUICtrlCreateInput("", 88, 8, 433, 21)
$Input2 = GUICtrlCreateInput("", 88, 40, 433, 21)
$Button3 = GUICtrlCreateButton("Copy", 8, 72, 75, 25)
$Progress1 = GUICtrlCreateProgress(88, 72, 430, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Button1
$path = FileSelectFolder ( "", "", "")
GUICtrlSetData($Input1, $path & "\")
Case $Button2
$path = FileSelectFolder ( "", "", "")
GUICtrlSetData($Input2, $path & "\")
Case $Button3
FileCopy("$ GUICtrlRead($Input1) $", "$ GUICtrlRead($Input2) $", 9)
EndSwitch
WEnd
Вопрос как мне взять пути из Input для копирования и прикрутить к нему прогресс бар?

Iska
28-08-2021, 17:51
как мне взять пути из Input для копирования »
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <FileConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Program Files (x86)\koda_1.7.3.0\Forms\Form1.kxf
$Form1_1 = GUICreate("Form1", 532, 110, 192, 124)
$Button1 = GUICtrlCreateButton("Folder№1", 8, 8, 75, 25)
$Button2 = GUICtrlCreateButton("Folder№2", 8, 40, 75, 25)
$Input1 = GUICtrlCreateInput("", 88, 8, 433, 21)
$Input2 = GUICtrlCreateInput("", 88, 40, 433, 21)
$Button3 = GUICtrlCreateButton("Copy", 8, 72, 75, 25)
$Progress1 = GUICtrlCreateProgress(88, 72, 430, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()

Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Button1
$path = FileSelectFolder("Select source folder", "", $FSF_CREATEBUTTON + $FSF_NEWDIALOG + $FSF_EDITCONTROL, GUICtrlRead($Input1), $Form1_1)

If Not @error Then
GUICtrlSetData($Input1, $path)
EndIf
Case $Button2
$path = FileSelectFolder("Select destination folder", "", $FSF_CREATEBUTTON + $FSF_NEWDIALOG + $FSF_EDITCONTROL, GUICtrlRead($Input2), $Form1_1)

If Not @error Then
GUICtrlSetData($Input2, $path)
EndIf
Case $Button3
FileCopy(GUICtrlRead($Input1) & "\*.*", GUICtrlRead($Input2), $FC_OVERWRITE + $FC_CREATEPATH)
EndSwitch
WEnd

и прикрутить к нему прогресс бар? »
Получить файлы из исходного каталога $Input1, посчитать их количество или занимаемый объём (в зависимости от того, что именно Вы собираетесь считать за 100%), затем перебирать в цикле, копируя по одному, одновременно обновляя ProgressBar.

ZmeyRepack
28-08-2021, 18:13
Здравствуй Iska снова выручаешь. Получить файлы из исходного каталога $Input1, посчитать их количество. Только каталог должен быть копирован без изменений сохранив структуру под папок.

Iska
28-08-2021, 18:32
Тогда смотрите в сторону DirCopy(). Если нужен ProgressBar — то рекурсивный разбор каталога $Input1 для подсчёта количества/объёма, затем ещё один рекурсивный разбор $Input1 и DirCreate() для каждого с последующим FileCopy() и обновлением ProgressBar.

ZmeyRepack
28-08-2021, 20:23
Спасибо буде копать!!!




© OSzone.net 2001-2012