Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   AutoIt (http://forum.oszone.net/forumdisplay.php?f=103)
-   -   Добавить прогресс бар к скрипту (http://forum.oszone.net/showthread.php?t=247296)

support23 20-11-2012 10:37 2028791

Добавить прогресс бар к скрипту
 
Помогите добавить прогресс бар к скрипту:

PHP код:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>

#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode"1) ; Подключаем режим OnEvent



$Form2 
GUICreate("Form2"405294343227)
$sIniFile = @ScriptDir '\rcopy.ini'



$path IniRead($sIniFile'directory''path''')
$Input1 GUICtrlCreateInput($path244820121$GUI_SS_DEFAULT_INPUT)

$list IniRead($sIniFile'directory''list''')
$Input2 GUICtrlCreateInput($list2411220121$GUI_SS_DEFAULT_INPUT)



$Button1 GUICtrlCreateButton("Copy"320567549)

$Button2 GUICtrlCreateButton("Button2"224482725$BS_ICON)
GUICtrlSetImage(-1"shell32.dll"40)
$Button3 GUICtrlCreateButton("Button3"2241122725$BS_ICON)
GUICtrlSetImage(-1"shell32.dll"40)



$Label1 GUICtrlCreateLabel("Папка с файлами"24249417)
GUICtrlCreateLabel(""168844)
$Label2 GUICtrlCreateLabel("Путь к списку"24887517)
$Button4 GUICtrlCreateButton("Выход"3202567525)

GUICtrlSetOnEvent($Button1"_startcopy")
GUICtrlSetOnEvent($Button2"_path")
GUICtrlSetOnEvent($Button3"_list")
GUICtrlSetOnEvent($Button4"close")


GUISetOnEvent($GUI_EVENT_CLOSE"Close")
HotKeySet("{PAUSE}""Close")
GUISetState(@SW_SHOW)


#EndRegion ### END Koda GUI section ###




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

    EndSwitch
WEnd


Func _startcopy
()
$file FileOpen($list0)

Проверяетявляется ли файл открытымперед тем как использовать функции чтения/записи в файл
If $file = -1 Then
    MsgBox
(4096"Ошибка""Невозможно открыть файл.")
    Exit
EndIf

Читает построчно текстпока не будет достигнут конец файла EOF
While 1
    $line 
FileReadLine($file)
    If @
error = -1 Then ExitLoop
    
;MsgBox(4096"Прочитанная строка:"$line)
    
FileCopy($path$line1)
WEnd

FileClose
($file)
EndFunc





Func _path
()
$var FileOpenDialog('Выберите файлы', @WorkingDir "\", "Файлы (*.*)", 1 + 4 )
$path = GUICtrlSetData($input1, $var)
EndFunc

Func _list()
$var2 = FileOpenDialog('Выбрать файл списка', @WorkingDir & "", "
Файл списка(*.log;*.txt;*.lst)", 1 + 8)
$list = GUICtrlSetData($input2, $var2)
EndFunc




Func Close()
    Exit
EndFunc 

Заранее спасибо!

madmasles 25-11-2012 06:53 2032284

support23,
Посмотрите здесь: Копируем файлы без "тормозов"


Время: 00:04.

Время: 00:04.
© OSzone.net 2001-