2012. 9. 5. 11:00
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\..\Documents\Icons\sync1.ico
#AutoIt3Wrapper_Outfile_x64=..\My Sync.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=My Simple Sync
#AutoIt3Wrapper_Res_Fileversion=1.0.0.3
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_LegalCopyright=Copyright 2012 (C) W.K.SEONG
#AutoIt3Wrapper_Res_Language=1042
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
Global $sMain = "My Sync"
Global $SetSync = @ScriptDir & "\Settings.ini"
Global $FSource = IniRead($SetSync, "Default", "Source", "")
Global $FDest = IniRead($SetSync, "Default", "Destination", "")
Global $sName, $Label1, $Label2, $Label3, $Input1, $Input2, $Radio1, $Radio2, $Select
Global $Button1, $Button2, $Button3, $Button4, $Button5, $var, $Form
If Not FileExists($SetSync) Then
IniWrite($SetSync, "Default", "Source", "")
IniWrite($SetSync, "Default", "Destination", "")
IniWrite($SetSync, "Default", "sync", "0")
EndIf
_Mainwindow()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
IniWrite($SetSync, "Default", "Source", "")
IniWrite($SetSync, "Default", "Destination", "")
IniWrite($SetSync, "Default", "sync", "0")
Exit
Case $msg = $Button1
$Check = GUICtrlRead($sName)
$FolderA = FileSelectFolder("원본 폴더를 선택하세요.", "", 1)
If $FolderA <> "" Then
IniWrite($SetSync, $Check, "Source", $FolderA)
GUICtrlSetData($Input1, $FolderA)
Else
MsgBox(0, "Error", "대상이 선택되지 않았습니다.")
EndIf
Case $msg = $Button2
$FolderB = FileSelectFolder("대상 폴더를 선택하세요.", "", 1)
If $FolderB <> "" Then
IniWrite($SetSync, $Check, "Destination", $FolderB)
GUICtrlSetData($Input2, $FolderB)
Else
MsgBox(0, "Error", "대상이 선택되지 않았습니다.")
EndIf
Case $msg = $Radio1
_SyncCheck()
Case $msg = $Radio2
_SyncCheck()
Case $msg = $Select
$Check = GUICtrlRead($Select)
_SelectCombo()
For $i = 1 To $var[0]
If $Check = $var[$i] Then
GUICtrlSetData($sName, $Check)
$SourceA = IniRead($SetSync, $Check, "Source", "")
$DestA = IniRead($SetSync, $Check, "Destination", "")
GUICtrlSetData($Input1, $SourceA)
GUICtrlSetData($Input2, $DestA)
GUICtrlSetData($Select, $Check)
EndIf
Next
_RadioCheck()
Case $msg = $Button3
$New = InputBox("새작업", "작업할 이름을 넣으세요", "", "", 150, 125, (@DesktopWidth - 150) / 2, (@DesktopHeight - 125) / 2)
If $New <> "" Then
$FA = FileSelectFolder("원본 폴더를 선택하세요.", "", 1)
If $FA <> "" Then
IniWrite($SetSync, $New, "Source", $FA)
GUICtrlSetData($Input1, $FA)
Else
MsgBox(0, "Error", "대상이 선택되지 않았습니다.")
EndIf
$FB = FileSelectFolder("대상 폴더를 선택하세요.", "", 1)
If $FB <> "" Then
IniWrite($SetSync, $New, "Destination", $FB)
GUICtrlSetData($Input2, $FB)
Else
MsgBox(0, "Error", "대상이 선택되지 않았습니다.")
EndIf
_SelectCombo()
GUICtrlSetData($sName, $New)
GUICtrlSetData($Select, $New, $New)
_SyncCheck()
EndIf
Case $msg = $Button4
$Check = GUICtrlRead($sName)
If MsgBox(4, "작업 삭제!", "현재 작업(" & $Check & ")을 삭제합니다.", "", $Form) = 6 Then
IniDelete($SetSync, $Check, "Source")
IniDelete($SetSync, $Check, "Destination")
IniDelete($SetSync, $Check, "sync")
IniDelete($SetSync, $Check)
GUICtrlSetData($sName, "Default")
GUICtrlSetData($Input1, IniRead($SetSync, "Default", "Source", ""))
GUICtrlSetData($Input2, IniRead($SetSync, "Default", "Destination", ""))
_SelectCombo()
EndIf
Case $msg = $Button5
_sCommand()
EndSelect
WEnd
Exit
Func _Mainwindow()
$Form = GUICreate($sMain, 535, 125, (@DesktopWidth - 535) / 2, (@DesktopHeight - 200) / 2)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$jopName = GUICtrlCreateLabel("작 업 :", 8, 10, 44, 25)
$sName = GUICtrlCreateLabel("Default", 66, 10, 200, 25)
GUICtrlSetFont(-1, 9, 800, 0, "굴림")
$Label1 = GUICtrlCreateLabel("원 본 :", 8, 35, 44, 25)
$Label2 = GUICtrlCreateLabel("대 상 :", 8, 61, 44, 25)
$Input1 = GUICtrlCreateInput("", 64, 32, 400, 21)
GUICtrlSetData(-1, $FSource)
$Input2 = GUICtrlCreateInput("", 64, 57, 400, 21)
GUICtrlSetData(-1, $FDest)
$Button1 = GUICtrlCreateButton("찾기...", 470, 30, 56, 25)
$Button2 = GUICtrlCreateButton("찾기...", 470, 55, 56, 25)
$Label3 = GUICtrlCreateLabel("선 택 :", 8, 97, 44, 25)
$Radio1 = GUICtrlCreateRadio("동기화", 64, 90, 60, 25)
_RadioCheck()
$Radio2 = GUICtrlCreateRadio("백 업", 130, 90, 50, 25)
_RadioCheck()
$Select = GUICtrlCreateCombo("", 185, 93, 110, 25)
_SelectCombo()
$Button3 = GUICtrlCreateButton("작업 추가", 307, 90, 70, 25, 0)
$Button4 = GUICtrlCreateButton("작업 삭제", 382, 90, 70, 25, 0)
$Button5 = GUICtrlCreateButton("실 행", 457, 90, 70, 25, 0)
GUICtrlSetState(-1, $GUI_FOCUS)
GUISetState()
EndFunc
Func _SelectCombo()
$j = ""
$var = IniReadSectionNames($SetSync)
For $i = 1 To $var[0]
$j = $j & "|" & $var[$i]
GUICtrlSetData($Select, $j, "Default")
Next
EndFunc
Func _sCommand()
Local $Source = GUICtrlRead($Input1)
Local $Dest = GUICtrlRead($Input2)
Local $sJop = GUICtrlRead($sName)
Local $sCase = IniRead($SetSync, $sJop, "sync", "")
Switch $sCase = "0"
Case True
$sPDI = Run(@ComSpec & " /c xcopy " & Chr(34) & $Source & Chr(34) & " " & Chr(34) & $Dest & Chr(34) & "\" & " /c /d /e /k /h /y")
Case False
$sPDI = Run(@ComSpec & " /c xcopy " & Chr(34) & $Source & Chr(34) & " " & Chr(34) & $Dest & Chr(34) & "\" & " /c /d /e /k /h /y && xcopy " & Chr(34) & $Dest & Chr(34) & " " & Chr(34) & $Source & Chr(34) & "\" & " /c /d /e /k /h /y")
EndSwitch
_sMoveCMD()
While 1
Sleep(250)
If ProcessExists($sPDI) = 0 Then
SplashTextOn("", "모든 작업이 성공적으로 완료되었습니다.", "400", "50",(@DesktopWidth - 400) / 2, (@DesktopHeight - 50) / 2, 33, "맑은 고딕","14","400")
Sleep(1500)
SplashOff()
ExitLoop
EndIf
WEnd
EndFunc
Func _RadioCheck()
Local $sJop = GUICtrlRead($sName)
If IniRead($SetSync, $sJop, "sync", "") = 1 Then
GUICtrlSetState($Radio1, $GUI_CHECKED)
Else
GUICtrlSetState($Radio2, $GUI_CHECKED)
EndIf
EndFunc
Func _SyncCheck()
Local $Check = GUICtrlRead($sName)
Local $CheckSet = GUICtrlRead($Radio1)
If $CheckSet = 1 Then
IniWrite($SetSync, $Check, "sync", "1")
Else
IniWrite($SetSync, $Check, "sync", "0")
EndIf
EndFunc
Func _sMoveCMD()
WinWaitActive("[Class:ConsoleWindowClass]", "", 1)
WinMove("[CLASS:ConsoleWindowClass]", "", (@DesktopWidth - 677) / 2, (@DesktopHeight - 520) / 2)
WinActivate("[Class:ConsoleWindowClass]", "")
EndFunc
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\..\Documents\Icons\sync1.ico
#AutoIt3Wrapper_Outfile_x64=..\My Sync.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=My Simple Sync
#AutoIt3Wrapper_Res_Fileversion=1.0.0.3
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_LegalCopyright=Copyright 2012 (C) W.K.SEONG
#AutoIt3Wrapper_Res_Language=1042
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
Global $sMain = "My Sync"
Global $SetSync = @ScriptDir & "\Settings.ini"
Global $FSource = IniRead($SetSync, "Default", "Source", "")
Global $FDest = IniRead($SetSync, "Default", "Destination", "")
Global $sName, $Label1, $Label2, $Label3, $Input1, $Input2, $Radio1, $Radio2, $Select
Global $Button1, $Button2, $Button3, $Button4, $Button5, $var, $Form
If Not FileExists($SetSync) Then
IniWrite($SetSync, "Default", "Source", "")
IniWrite($SetSync, "Default", "Destination", "")
IniWrite($SetSync, "Default", "sync", "0")
EndIf
_Mainwindow()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
IniWrite($SetSync, "Default", "Source", "")
IniWrite($SetSync, "Default", "Destination", "")
IniWrite($SetSync, "Default", "sync", "0")
Exit
Case $msg = $Button1
$Check = GUICtrlRead($sName)
$FolderA = FileSelectFolder("원본 폴더를 선택하세요.", "", 1)
If $FolderA <> "" Then
IniWrite($SetSync, $Check, "Source", $FolderA)
GUICtrlSetData($Input1, $FolderA)
Else
MsgBox(0, "Error", "대상이 선택되지 않았습니다.")
EndIf
Case $msg = $Button2
$FolderB = FileSelectFolder("대상 폴더를 선택하세요.", "", 1)
If $FolderB <> "" Then
IniWrite($SetSync, $Check, "Destination", $FolderB)
GUICtrlSetData($Input2, $FolderB)
Else
MsgBox(0, "Error", "대상이 선택되지 않았습니다.")
EndIf
Case $msg = $Radio1
_SyncCheck()
Case $msg = $Radio2
_SyncCheck()
Case $msg = $Select
$Check = GUICtrlRead($Select)
_SelectCombo()
For $i = 1 To $var[0]
If $Check = $var[$i] Then
GUICtrlSetData($sName, $Check)
$SourceA = IniRead($SetSync, $Check, "Source", "")
$DestA = IniRead($SetSync, $Check, "Destination", "")
GUICtrlSetData($Input1, $SourceA)
GUICtrlSetData($Input2, $DestA)
GUICtrlSetData($Select, $Check)
EndIf
Next
_RadioCheck()
Case $msg = $Button3
$New = InputBox("새작업", "작업할 이름을 넣으세요", "", "", 150, 125, (@DesktopWidth - 150) / 2, (@DesktopHeight - 125) / 2)
If $New <> "" Then
$FA = FileSelectFolder("원본 폴더를 선택하세요.", "", 1)
If $FA <> "" Then
IniWrite($SetSync, $New, "Source", $FA)
GUICtrlSetData($Input1, $FA)
Else
MsgBox(0, "Error", "대상이 선택되지 않았습니다.")
EndIf
$FB = FileSelectFolder("대상 폴더를 선택하세요.", "", 1)
If $FB <> "" Then
IniWrite($SetSync, $New, "Destination", $FB)
GUICtrlSetData($Input2, $FB)
Else
MsgBox(0, "Error", "대상이 선택되지 않았습니다.")
EndIf
_SelectCombo()
GUICtrlSetData($sName, $New)
GUICtrlSetData($Select, $New, $New)
_SyncCheck()
EndIf
Case $msg = $Button4
$Check = GUICtrlRead($sName)
If MsgBox(4, "작업 삭제!", "현재 작업(" & $Check & ")을 삭제합니다.", "", $Form) = 6 Then
IniDelete($SetSync, $Check, "Source")
IniDelete($SetSync, $Check, "Destination")
IniDelete($SetSync, $Check, "sync")
IniDelete($SetSync, $Check)
GUICtrlSetData($sName, "Default")
GUICtrlSetData($Input1, IniRead($SetSync, "Default", "Source", ""))
GUICtrlSetData($Input2, IniRead($SetSync, "Default", "Destination", ""))
_SelectCombo()
EndIf
Case $msg = $Button5
_sCommand()
EndSelect
WEnd
Exit
Func _Mainwindow()
$Form = GUICreate($sMain, 535, 125, (@DesktopWidth - 535) / 2, (@DesktopHeight - 200) / 2)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$jopName = GUICtrlCreateLabel("작 업 :", 8, 10, 44, 25)
$sName = GUICtrlCreateLabel("Default", 66, 10, 200, 25)
GUICtrlSetFont(-1, 9, 800, 0, "굴림")
$Label1 = GUICtrlCreateLabel("원 본 :", 8, 35, 44, 25)
$Label2 = GUICtrlCreateLabel("대 상 :", 8, 61, 44, 25)
$Input1 = GUICtrlCreateInput("", 64, 32, 400, 21)
GUICtrlSetData(-1, $FSource)
$Input2 = GUICtrlCreateInput("", 64, 57, 400, 21)
GUICtrlSetData(-1, $FDest)
$Button1 = GUICtrlCreateButton("찾기...", 470, 30, 56, 25)
$Button2 = GUICtrlCreateButton("찾기...", 470, 55, 56, 25)
$Label3 = GUICtrlCreateLabel("선 택 :", 8, 97, 44, 25)
$Radio1 = GUICtrlCreateRadio("동기화", 64, 90, 60, 25)
_RadioCheck()
$Radio2 = GUICtrlCreateRadio("백 업", 130, 90, 50, 25)
_RadioCheck()
$Select = GUICtrlCreateCombo("", 185, 93, 110, 25)
_SelectCombo()
$Button3 = GUICtrlCreateButton("작업 추가", 307, 90, 70, 25, 0)
$Button4 = GUICtrlCreateButton("작업 삭제", 382, 90, 70, 25, 0)
$Button5 = GUICtrlCreateButton("실 행", 457, 90, 70, 25, 0)
GUICtrlSetState(-1, $GUI_FOCUS)
GUISetState()
EndFunc
Func _SelectCombo()
$j = ""
$var = IniReadSectionNames($SetSync)
For $i = 1 To $var[0]
$j = $j & "|" & $var[$i]
GUICtrlSetData($Select, $j, "Default")
Next
EndFunc
Func _sCommand()
Local $Source = GUICtrlRead($Input1)
Local $Dest = GUICtrlRead($Input2)
Local $sJop = GUICtrlRead($sName)
Local $sCase = IniRead($SetSync, $sJop, "sync", "")
Switch $sCase = "0"
Case True
$sPDI = Run(@ComSpec & " /c xcopy " & Chr(34) & $Source & Chr(34) & " " & Chr(34) & $Dest & Chr(34) & "\" & " /c /d /e /k /h /y")
Case False
$sPDI = Run(@ComSpec & " /c xcopy " & Chr(34) & $Source & Chr(34) & " " & Chr(34) & $Dest & Chr(34) & "\" & " /c /d /e /k /h /y && xcopy " & Chr(34) & $Dest & Chr(34) & " " & Chr(34) & $Source & Chr(34) & "\" & " /c /d /e /k /h /y")
EndSwitch
_sMoveCMD()
While 1
Sleep(250)
If ProcessExists($sPDI) = 0 Then
SplashTextOn("", "모든 작업이 성공적으로 완료되었습니다.", "400", "50",(@DesktopWidth - 400) / 2, (@DesktopHeight - 50) / 2, 33, "맑은 고딕","14","400")
Sleep(1500)
SplashOff()
ExitLoop
EndIf
WEnd
EndFunc
Func _RadioCheck()
Local $sJop = GUICtrlRead($sName)
If IniRead($SetSync, $sJop, "sync", "") = 1 Then
GUICtrlSetState($Radio1, $GUI_CHECKED)
Else
GUICtrlSetState($Radio2, $GUI_CHECKED)
EndIf
EndFunc
Func _SyncCheck()
Local $Check = GUICtrlRead($sName)
Local $CheckSet = GUICtrlRead($Radio1)
If $CheckSet = 1 Then
IniWrite($SetSync, $Check, "sync", "1")
Else
IniWrite($SetSync, $Check, "sync", "0")
EndIf
EndFunc
Func _sMoveCMD()
WinWaitActive("[Class:ConsoleWindowClass]", "", 1)
WinMove("[CLASS:ConsoleWindowClass]", "", (@DesktopWidth - 677) / 2, (@DesktopHeight - 520) / 2)
WinActivate("[Class:ConsoleWindowClass]", "")
EndFunc
펌 // http://blog.naver.com/seongwk?Redirect=Log&logNo=70122793090
'도움말들.... > 오토잇' 카테고리의 다른 글
AutoIt 언어의 기초인 언어 레퍼런스 (0) | 2012.09.05 |
---|---|
OS 구분하여 Firefox 설치 (0) | 2012.09.05 |
WinRAR 4.11 한글 자동설치 스크립트 (0) | 2012.09.05 |
OS( x86) (x64) 구분 설치.. (0) | 2012.09.05 |
악성코드 광고 프로그램 언인스톨 CP_2.7 오토잇 소스 (0) | 2012.09.05 |