-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAutoISO.au3
114 lines (73 loc) · 3.39 KB
/
AutoISO.au3
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
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_Fileversion=1.1
#AutoIt3Wrapper_Res_LegalCopyright=MIT [email protected]
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
opt("TrayIconHide",True)
;Your DVD/CD Drive Letter.
Global $Drive = "E:"
;Where you want the ISO Images to be stored.
Global $PathToISOs = "D:\ISOs\"
;Path to where ImgBurn is Installed. Required to create ISO Images
Global $PathToImgBurn = "C:\Program Files (x86)\ImgBurn\"
;Case Insensitive Windows Title Match Mode with Any Position (WildCard).
Opt("WinTitleMatchMode", -2)
;Main Thread
While 1
;See Function Comments for AutoISO()
AutoISO()
;Prevents excessive cpu workload
Sleep(1000)
WEnd
Func AutoISO()
;If Non-Empty Disk is Present
If DirGetSize($Drive) > 0 Then
;Do Nothing and resumes the script at line 42.
Sleep(0)
Else
;Return 0 = No Disk Present/Empty Disk Present - Skips ISO Creation
Return 0
EndIf
;Store the Disk Label to a String Variable
Local $DiskName = DriveGetLabel($Drive)
;If ISO has already been made for this disk
If FileExists($PathToISOs & $DiskName & ".iso") Then
;Return 2 = Already created ISO Image, Skipping
Return 2
Else
; Else create the ISO Image with the MakeISO() function.
MakeISO($DiskName)
;If ISO Image exists then
If FileExists($PathToISOs & $DiskName & ".iso") Then
;Inform the user the ISO was created successfully. Also asks the user if they want to give the ISO a different name. Due to how AutoISO tracks already created ISOs, it will create an info file with the User Specified name appended.
Local $answer = MsgBox(4, "AutoISO", 'ISO "' & $DiskName & '" Created Successfully! ' & @CRLF & 'Would you like to give it a name that properly identifies this ISO?' & @CRLF & '(Note: You cannnot rename the ISO, else clones will be created, instead a text document is created next to it with the disk title.)')
;If Yes then
If $answer = 6 Then
;Asks the user what they want the Identifying Name to be.
Local $NewName = InputBox("AutoISO", "What do you want to call it?")
;Creates the Info File for the ISO
FileWrite($PathToISOs & $DiskName & " - " & $NewName & ".txt", 'The path to this ISO is "' & $PathToISOs & $DiskName & '.iso' & @CRLF & 'The user given name for this ISO is "' & $NewName & '"')
Else
;Uses the DiskName as the Identifying Name
Local $NewName = $DiskName
;Creates the Info File for the ISO
FileWrite($PathToISOs & $DiskName & ".txt", 'The path to this ISO is "' & $PathToISOs & $DiskName & '.iso' & @CRLF & 'The user given name for this ISO is "' & $NewName & '"')
EndIf
;Return 1 = Ripped Successfully
Return 1
Else
;Alert user that ISO creation failed and will be retried.
if not MsgBox(1, "AutoISO", "ISO Creation Failed, Retrying.") = 1 then exit
;Return -1 = Ripped Unsuccessfully - Retrying...
Return -1
EndIf
EndIf
EndFunc ;==>AutoISO
Func MakeISO($DiskName)
;Start ImgBurn with the Global Settings, Creating the ISO, and self-closes when done.
Local $PID = ShellExecute("imgburn.exe", '/MODE READ /SRC ' & $Drive & ' /DEST "' & $PathToISOs & $DiskName & '.iso" /VERIFY YES /EJECT NO /WAITFORMEDIA /START /CLOSESUCCESS', $PathToImgBurn)
;Wait for ImgBurn to finish.
ProcessWaitClose($PID)
;Wait for an additional second to allow all handles and threads to release the ISO.
Sleep(1000)
EndFunc ;==>MakeISO