-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorzFilePosterCopier.ahkx
120 lines (99 loc) · 3.57 KB
/
orzFilePosterCopier.ahkx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#NoEnv ;Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance off
#NoTrayIcon
Main:
FileEncoding, UTF-8-RAW
SetFormat, float, 0.2
/*
If 0<>2
ExitApp
*/
1 = orzFIlePoster.lst
2 = D
FileSizeCount = 0
FileSizeCount2 = 0
FileCount = 0
FileCount2 = 0
logPathStart = %A_ScriptDir%\orzFliePoster_drive
logPathEnd = .log
IniWrite, Prepareing, %logPathStart%%2%%logPathEnd%, Status, Status
IniWrite, %2%, %logPathStart%%2%%logPathEnd%, Status, Drive
Loop, read, %1%
{
StringSplit, ImportFileName, A_LoopReadLine, %A_Tab%
FileGetSize, FileSize, %ImportFileName1%
FileSizeCount := FileSizeCount + FileSize
FileCount := FileCount + 1
}
DriveGet, DriveLabel, Label, %2%:
DriveGet, DriveCapacity, capacity, %2%:
DriveSpaceFree, DriveFree, %2%:
if ErrorLevel
{
;Write log
IniWrite, Error, %logPathStart%%2%%logPathEnd%, Status, Status
IniWrite, noDrive, %logPathStart%%2%%logPathEnd%, Status, ErrorReason
Return
}
;todo: Here we should read the settings and play the wav, and close the autoplay box opened by Windows, and some more(360?)
;Check the disk if it would be full
;Here DriveFree uses MB while FileSizeCount uses byte
If(DriveFree*1048576 < FileSizeCount)
{
IniWrite, Error, %logPathStart%%2%%logPathEnd%, Status, Status
IniWrite, DriveFull, %logPathStart%%2%%logPathEnd%, Status, ErrorReason
Return
}
IniWrite, Copying, %logPathStart%%2%%logPathEnd%, Status, Status
IniWrite, %DriveCapacity%, %logPathStart%%2%%logPathEnd%, Status, DriveCapacity
IniWrite, %DriveFree%, %logPathStart%%2%%logPathEnd%, Status, DriveFree ;unstable
IniWrite, %FileCount%, %logPathStart%%2%%logPathEnd%, Status, FilesCount
IniWrite, %FileSizeCount%, %logPathStart%%2%%logPathEnd%, Status, FilesSize
IniWrite, 0, %logPathStart%%2%%logPathEnd%, Status, FilesFinished ;unstable
IniWrite, 0, %logPathStart%%2%%logPathEnd%, Status, FilesSizeFinished ;unstable
Loop, read, %1%
{
StringSplit, ImportFileName, A_LoopReadLine, %A_Tab%
FileGetSize, FileSize, %ImportFileName1%
DestFile = %2%:%ImportFileName2%
SplitPath, DestFile, DestName, DestDir
IniWrite, %DestName%, %logPathStart%%2%%logPathEnd%, Status, FileName
IniWrite, %DestFile%, %logPathStart%%2%%logPathEnd%, Status, FileDestPath
FileCreateDir, %DestDir%
FileCopy, %ImportFileName1%, %DestFile%, 1
;error progress
if ErrorLevel
{
;todo:do sth.
IniWrite, Error, %logPathStart%%2%%logPathEnd%, Status, Status
IniWrite, noDrive, %logPathStart%%2%%logPathEnd%, Status, ErrorReason
Return
}
FileSizeCount2 := FileSizeCount2 + FileSize
FileCount2 := FileCount2 + 1
DriveSpaceFree, DriveFree, %2%:
IniWrite, %DriveFree%, %logPathStart%%2%%logPathEnd%, Status, DriveFree
IniWrite, %FileCount2%, %logPathStart%%2%%logPathEnd%, Status, FilesFinished
IniWrite, %FileSizeCount2%, %logPathStart%%2%%logPathEnd%, Status, FilesSizeFinished
IniRead, isRequestingStop, %logPathStart%%2%%logPathEnd%, Request, StopNow, 0
If(isRequestingStop){
;todo:Do sth.
Exit
}
}
IniWrite, Finished, %logPathStart%%2%%logPathEnd%, Status, Status
IniDelete, %logPathStart%%2%%logPathEnd%, Status, FileName
IniDelete, %logPathStart%%2%%logPathEnd%, Status, FileDestPath
/*
Run, eject.exe /REMOVELETTER %2%
Sleep 1000
IfWinExist, eject.exe
{
WinClose
MsgBox 16,, %DriveLabel% (%2%:) %DrivePercent%`% (%DriveFree% mb / %DriveCapacity% mb) 移除失败,请检查。
}
Else
{
MsgBox 64,, 请移除 %DriveLabel% (%2%:) %DrivePercent%`% (%DriveFree% mb / %DriveCapacity% mb)。
}
*/