-
Notifications
You must be signed in to change notification settings - Fork 0
/
UniFiCameraImageArchiverFTPUploader_v1.5.au3
1571 lines (1565 loc) · 83.7 KB
/
UniFiCameraImageArchiverFTPUploader_v1.5.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <Array.au3>
#include <ButtonConstants.au3>
#include <Date.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <FTPEx.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <Inet.au3>
#include <InetConstants.au3>
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#include <WinAPIHObj.au3>
#include <WindowsConstants.au3>
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Resources\phoenixtray.ico
#AutoIt3Wrapper_Outfile=Builds\UniFiCameraImageArchiverFTPUploader_v1.5.exe
#AutoIt3Wrapper_Res_Comment=UniFi Camera Image Archiver & FTP Uploader by Phoenix125.com
#AutoIt3Wrapper_Res_Description=UniFi Camera Image Archiver & FTP Uploader
#AutoIt3Wrapper_Res_Fileversion=1.5
#AutoIt3Wrapper_Res_ProductName=UniFi Camera Image Archiver & FTP Uploader
#AutoIt3Wrapper_Res_ProductVersion=1.5
#AutoIt3Wrapper_Res_CompanyName=http://www.Phoenix125.com
#AutoIt3Wrapper_Res_LegalCopyright=http://www.Phoenix125.com
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Run_AU3Check=n
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/mo
#AutoIt3Wrapper_Res_Icon_Add=Resources\discord.ico
#AutoIt3Wrapper_Res_Icon_Add=Resources\info.ico
#AutoIt3Wrapper_Res_Icon_Add=Resources\forum.ico
#AutoIt3Wrapper_Res_Icon_Add=Resources\manual.ico
#AutoIt3Wrapper_Res_Icon_Add=Resources\refresh.ico
#AutoIt3Wrapper_Res_Icon_Add=Resources\refreshnotice.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Global $aUtilName = "UniFiCameraImageArchiverFTPUploader"
Global $aUtilFileName = StringStripWS($aUtilName, 8)
Global $aFolderTemp = @ScriptDir & "\" & $aUtilFileName & "UtilFiles\"
If Not FileExists($aFolderTemp) Then
Do
DirCreate($aFolderTemp)
Until FileExists($aFolderTemp)
EndIf
FileInstall("K:\AutoIT\_MyProgs\UniFiCameraImageArchiverFTPUploader\Resources\phoenixlogo.jpg", $aFolderTemp, 0)
If @Compiled = 0 Then
Global $aIconFile = @ScriptDir & "\" & $aUtilFileName & "Icons.exe"
Else
Global $aIconFile = @ScriptFullPath
EndIf
Global $cButtonDefaultBackground = "0xDEDEDE" ; Light Gray
Global $cRedFaded = "0xB89B9B" ; Faded Red
Global $cYellowHighlight = "0xFFFF00"
Global $cGreenFaded = "0xA5B89B"
Global $cBackgroundGray = "0x808080"
Global $cGreenLime = "0x00FF00"
Opt("GUIOnEventMode", 1)
Local $tExit = False
Global $aUtilVersion = "v1.5"
Global $aUtilVer = $aUtilVersion
Global $aUtilVerNumber = 0 ; New number assigned for each config file change. Used to write temp update script so that users are not forced to update config.
Global $aIniFile = @ScriptDir & "\" & $aUtilName & ".ini"
Global $aUtilCFGFile = $aFolderTemp & $aUtilName & "_cfg.ini"
Global $aUtilUpdateLinkVer = "http://www.phoenix125.com/share/" & StringLower($aUtilName) & "/latestver.txt"
Global $aUtilUpdateLinkDL = "http://www.phoenix125.com/share/" & StringLower($aUtilName) & "/" & $aUtilName & ".zip"
Global $aUtilReadMeLink = "http://www.phoenix125.com/share/" & StringLower($aUtilName) & "/ReadMe.pdf"
Global $aUtilUpdateFile = @ScriptDir & "\__UTIL_UPDATE_AVAILABLE___.txt"
Global $aStartText = $aUtilName & " " & $aUtilVersion & " starting . . ." & @CRLF & @CRLF
Global $aSplash = _Splash($aStartText, 0, 475)
Global $aCFGLastVerNumber = IniRead($aUtilCFGFile, "CFG", "aCFGLastVerNumber", $aUtilVerNumber)
Global $aExitGUIG = False
Global $aLastCam = 0
Global $W_ConfigWindow = 999999
ReadCFG()
ControlSetText($aSplash, "", "Static1", $aStartText & "Creating startup batch file")
CreateStartupBatchFile()
ControlSetText($aSplash, "", "Static1", $aStartText & "Importing config settings")
Local $tChanged = ReadIni()
For $x = 0 To ($aNumberOfEntries - 1)
If $xIntervalSave[$x] <= $xIntervalFTP[$x] Then
$tGetImageInterval[$x] = $xIntervalSave[$x]
Else
$tGetImageInterval[$x] = $xIntervalFTP[$x]
EndIf
$cIntervalGetImage[$x] = _NowCalc()
$cIntervalFTP[$x] = _NowCalc()
$cIntervalSave[$x] = _NowCalc()
Next
If $aLogLevel < 3 Then LogWrite("----- ===== " & $aUtilName & " started ===== -----")
ControlSetText($aSplash, "", "Static1", $aStartText & "Creating tray icon menu")
Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode.
Opt("TrayOnEventMode", 1)
Local $iTrayVersion = TrayCreateItem($aUtilName & " " & $aUtilVersion)
TrayItemSetOnEvent(-1, "TrayAbout")
TrayCreateItem("")
Local $iTrayAbout = TrayCreateItem("About")
TrayItemSetOnEvent(-1, "TrayAbout")
Local $iTrayUpdateUtilCheck = TrayCreateItem("Check for Update")
TrayItemSetOnEvent(-1, "TrayUpdateUtilCheck")
Local $iTrayUpdateUtilCheck = TrayCreateItem("Restart")
TrayItemSetOnEvent(-1, "TrayRestartUtil")
Local $iTrayUpdateUtilCheck = TrayCreateItem("Open ReadMe")
TrayItemSetOnEvent(-1, "TrayOpenReadMe")
TrayCreateItem("")
Local $iTrayExitCloseN = TrayCreateItem("Open LOG (Latest)")
TrayItemSetOnEvent(-1, "TrayOpenLog")
Local $iTrayExitCloseN = TrayCreateItem("Open CONFIG")
TrayItemSetOnEvent(-1, "TrayOpenConfig")
Local $iTrayExitCloseN = TrayCreateItem("Open IMAGE folder")
TrayItemSetOnEvent(-1, "TrayOpenImageFolder")
TrayCreateItem("")
Local $iTrayUpdateUtilPause = TrayCreateItem("Pause")
TrayItemSetOnEvent(-1, "TrayUpdatePause")
TrayCreateItem("")
Local $iTrayExitCloseY = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "TrayExit")
ControlSetText($aSplash, "", "Static1", $aStartText & "Saving config settings")
WriteINI()
If $tChanged = "new" Then
_GUI_Config()
P_HelpClick()
MsgBox(0, $aUtilName, "Welcome! For help, see ReadMe.pdf.", 10)
ElseIf $tChanged = "changed" Then
_GUI_Config()
EndIf
ControlSetText($aSplash, "", "Static1", $aStartText & "Checking for updates")
If $aUtilCheckForUpdateYN <> "no" Then
If IniRead($aUtilCFGFile, "CFG", "aRestartQuickYN", "no") <> "yes" Then UtilUpdate($aUtilUpdateLinkVer, $aUtilUpdateLinkDL, $aUtilVersion, $aUtilName, $aSplash, "show", "yes")
Else
FileDelete($aUtilUpdateFile)
EndIf
IniWrite($aUtilCFGFile, "CFG", "aRestartQuickYN", "no")
Local $tDiffSave = True
Local $tDiffFTP = True
Local $tDiffGetImage = True
Local $tErrorImageSave = False
Local $xFileName1 = ""
Local $tDiffSec = ""
For $x = 0 To ($aNumberOfEntries - 1)
$cTimerGetImage[$x] = TimerInit()
$cTimerRestartSave[$x] = TimerInit()
$cTimerRestartFTP[$x] = TimerInit()
Next
ControlSetText($aSplash, "", "Static1", $aStartText & "Startup complete.")
SplashOff()
FileDelete($aFolderTemp & $aUtilName & "_Delay_Restart.bat")
Do
For $xCam = 0 To ($aNumberOfEntries - 1)
If $xCameraEnableYN[$xCam] = "yes" Then
If TimerDiff($cTimerRestartSave[$xCam]) > $xIntervalSave[$xCam] * 1000 Then
$tDiffSave = True
$cTimerRestartSave[$xCam] = TimerInit()
EndIf
If TimerDiff($cTimerRestartFTP[$xCam]) > $xIntervalFTP[$xCam] * 1000 Then
$tDiffFTP = True
$cTimerRestartFTP[$xCam] = TimerInit()
EndIf
If TimerDiff($cTimerGetImage[$xCam]) > $tGetImageInterval[$xCam] * 1000 Then
$tDiffGetImage = True
$cTimerGetImage[$xCam] = TimerInit()
EndIf
If $tDiffGetImage Then
$tDiffGetImage = False
Local $tImageSize = 0
Local $sFile = $aFolderImage & "\" & $xFileNameOriginal[$xCam]
Local $tGet = InetGet($xURL[$xCam], $sFile, $INET_FORCERELOAD)
Local $tImageSize = FileGetSize($sFile)
If $tImageSize < 10000 Then
$tErrorImageSave = True
If $aLogLevel < 3 Then LogWrite("[ERROR] File failed to download from camera:" & $xURL[$xCam])
Else
$tErrorImageSave = False
If $xResizeImageYN[$xCam] = "yes" Then
Local $xImageSplit = StringSplit($xResizeImageSize[$xCam], "x", 2)
Local $tResizeX = Abs($xImageSplit[0])
Local $tResizeY = Abs($xImageSplit[1])
_ImageResizer($sFile, $aFolderImage & "\" & $xFileNameResized[$xCam], $tResizeX, $tResizeY)
EndIf
EndIf
EndIf
If $tDiffSave And $tErrorImageSave = False Then
$tDiffSave = False
If StringInStr($xSaveType[$xCam], "B") Or StringInStr($xSaveType[$xCam], "F") Then
Local $xFileNameSplit = _PathSplit($aFolderImage & "\" & $xFileNameOriginal[$xCam], "", "", "", "")
If $xSaveFileNumberYN[$xCam] = "no" Then
$tFileNameSave = $xFileNameSplit[3] & "_" & @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & @SEC & $xFileNameSplit[4]
Else
Local $tFileNameNumber = IniRead($aUtilCFGFile, "CFG", "aCFGCam(" & $xCam & ")FileNameNumberF", 0)
$tFileNameNumber += 1
Local $tFileNameExt = _AddLeadingZeros($tFileNameNumber, 6)
$tFileNameSave = _LettersOnly($xFileNameSplit[3]) & "_" & $tFileNameExt & $xFileNameSplit[4]
IniWrite($aUtilCFGFile, "CFG", "aCFGCam(" & $xCam & ")FileNameNumberF", $tFileNameNumber)
EndIf
If $xSaveMonthFolderYN[$xCam] = "yes" Then
Local $tSaveFolder = $xSaveFolder[$xCam] & "\" & @YEAR & "-" & @MON & "\"
Else
Local $tSaveFolder = $xSaveFolder[$xCam]
EndIf
DirCreate($tSaveFolder)
FileCopy($aFolderImage & "\" & $xFileNameOriginal[$xCam], $tSaveFolder & $tFileNameSave)
EndIf
If (StringInStr($xSaveType[$xCam], "B") Or StringInStr($xSaveType[$xCam], "R")) And $xResizeImageYN[$xCam] = "yes" Then
Local $xFileNameSplit = _PathSplit($aFolderImage & "\" & $xFileNameResized[$xCam], "", "", "", "")
If $xSaveFileNumberYN[$xCam] = "no" Then
$tFileNameSave = $xFileNameSplit[3] & "_" & @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & @MIN & @SEC & $xFileNameSplit[4]
Else
Local $tFileNameNumber = IniRead($aUtilCFGFile, "CFG", "aCFGCam(" & $xCam & ")FileNameNumberR", 0)
$tFileNameNumber += 1
Local $tFileNameExt = _AddLeadingZeros($tFileNameNumber, 6)
$tFileNameSave = _LettersOnly($xFileNameSplit[3]) & "_" & $tFileNameExt & $xFileNameSplit[4]
IniWrite($aUtilCFGFile, "CFG", "aCFGCam(" & $xCam & ")FileNameNumberR", $tFileNameNumber)
EndIf
If $xSaveMonthFolderYN[$xCam] = "yes" Then
Local $tSaveFolder = $xSaveFolder[$xCam] & "\" & @YEAR & "-" & @MON & "\"
Else
Local $tSaveFolder = $xSaveFolder[$xCam]
EndIf
DirCreate($tSaveFolder)
FileCopy($aFolderImage & "\" & $xFileNameResized[$xCam], $tSaveFolder & $tFileNameSave)
EndIf
EndIf
If $tDiffFTP And $tErrorImageSave = False Then
$tDiffFTP = False
Local $tTimerUpload = TimerInit()
If (StringInStr($xFTPUploadType[$xCam], "B") Or StringInStr($xFTPUploadType[$xCam], "F")) Then
If $xFTPURL[$xCam] <> "" Then
Local $tError = FTPFiles($aFolderImage & "\" & $xFileNameOriginal[$xCam], $xFTPFolder[$xCam], $xFTPURL[$xCam], $xUserID[$xCam], $xPwd[$xCam], $xFTPPort[$xCam])
$tDiffSec = StringFormat("%.2f", TimerDiff($tTimerUpload) / 1000, 2)
If $tError = 0 Then
If $aLogLevel = 1 Then LogWrite("[OK] Code[" & $tError & "] Time[" & $tDiffSec & "s] Upload successful [" & $xFileNameOriginal[$xCam] & "] FTP[" & $xFTPURL[$xCam] & "] UserID[" & $xUserID[$xCam] & "] Pwd[" & $xPwd[$xCam] & "]")
Else
If $aLogLevel < 3 Then LogWrite("[ERROR] Code[" & $tError & "] Time[" & $tDiffSec & "s] Upload FAILED. [" & $xFileNameOriginal[$xCam] & "] FTP[" & $xFTPURL[$xCam] & "] UserID[" & $xUserID[$xCam] & "] Pwd[" & $xPwd[$xCam] & "]")
EndIf
EndIf
EndIf
If (StringInStr($xFTPUploadType[$xCam], "B") Or StringInStr($xFTPUploadType[$xCam], "R")) And $xResizeImageYN[$xCam] = "yes" Then
If $xFTPURL[$xCam] <> "" Then
Local $tError = FTPFiles($aFolderImage & "\" & $xFileNameResized[$xCam], $xFTPFolder[$xCam], $xFTPURL[$xCam], $xUserID[$xCam], $xPwd[$xCam], $xFTPPort[$xCam])
$tDiffSec = StringFormat("%.2f", TimerDiff($tTimerUpload) / 1000, 2)
If $tError = 0 Then
If $aLogLevel = 1 Then LogWrite("[OK] Code[" & $tError & "] Time[" & $tDiffSec & "s] Upload successful [" & $xFileNameResized[$xCam] & "] FTP[" & $xFTPURL[$xCam] & "] UserID[" & $xUserID[$xCam] & "] Pwd[" & $xPwd[$xCam] & "]")
Else
If $aLogLevel < 3 Then LogWrite("[ERROR] Code[" & $tError & "] Time[" & $tDiffSec & "s] Upload FAILED. [" & $xFileNameResized[$xCam] & "] FTP[" & $xFTPURL[$xCam] & "] UserID[" & $xUserID[$xCam] & "] Pwd[" & $xPwd[$xCam] & "]")
EndIf
EndIf
EndIf
EndIf
EndIf
Next
Sleep(500)
Until $tExit
Func _AddLeadingZeros($tTxt3, $tDigits = 8, $tTrimTF = True)
Local $t2Len = StringLen($tTxt3)
If $t2Len < $tDigits Then
Local $t2Txt = ""
For $t2t = 1 To ($tDigits - $t2Len)
$t2Txt &= "0"
Next
$t2Txt &= $tTxt3
Return $t2Txt
ElseIf $t2Len > $tDigits And $tTrimTF Then
Return StringRight($tTxt3, $tDigits)
Else
Return $tTxt3
EndIf
EndFunc ;==>_AddLeadingZeros
Func ReadIni()
Local $tChanged = "nope"
Local $iniCheck = ""
Local $aChar[3]
For $i = 1 To 13
$aChar[0] = Chr(Random(97, 122, 1)) ;a-z
$aChar[1] = Chr(Random(48, 57, 1)) ;0-9
$iniCheck &= $aChar[Random(0, 1, 1)]
Next
Global $aNumberOfEntries = IniRead($aIniFile, " --------------- " & StringUpper($aUtilName) & " --------------- ", "Number of cameras/files to manage (1-100) ###", $iniCheck)
Global $aFolderLog = IniRead($aIniFile, " --------------- " & StringUpper($aUtilName) & " OPTIONS --------------- ", "Log folder ###", @ScriptDir & "\Logs\")
Global $aFolderImage = IniRead($aIniFile, " --------------- " & StringUpper($aUtilName) & " OPTIONS --------------- ", "Images temp folder ###", @ScriptDir & "\Images")
$aFolderImage = _RemoveTrailingSlash($aFolderImage)
Global $aLogLevel = IniRead($aIniFile, " --------------- " & StringUpper($aUtilName) & " OPTIONS --------------- ", "Log Level 1-All, 2-Fails, 3-None (1-3) ###", "1")
Global $aUtilCheckForUpdateYN = IniRead($aIniFile, " --------------- " & StringUpper($aUtilName) & " OPTIONS --------------- ", "Check for updates at program start? (yes/no) ###", "yes")
Global $aPreviousNumberOfEntries = IniRead($aUtilCFGFile, "CFG", "Previous number of entries ###", $iniCheck)
If $aNumberOfEntries = $iniCheck Then
$aNumberOfEntries = 2
$tChanged = "new"
Else
If $aNumberOfEntries <> $aPreviousNumberOfEntries Then $tChanged = "changed"
EndIf
If $aNumberOfEntries < 1 Then $aNumberOfEntries = 1
If $aNumberOfEntries > 100 Then $aNumberOfEntries = 100
If $aLogLevel < 1 Then $aLogLevel = 1
If $aLogLevel > 3 Then $aLogLevel = 3
DirCreate($aFolderLog)
DirCreate($aFolderImage & "\")
Global $cIntervalFTP[$aNumberOfEntries]
Global $cIntervalSave[$aNumberOfEntries]
Global $cIntervalGetImage[$aNumberOfEntries]
Global $tGetImageInterval[$aNumberOfEntries]
Global $cTimerGetImage[$aNumberOfEntries]
Global $cTimerRestartSave[$aNumberOfEntries]
Global $cTimerRestartFTP[$aNumberOfEntries]
Global $xNotes[$aNumberOfEntries]
Global $xCameraEnableYN[$aNumberOfEntries]
Global $xIntervalFTP[$aNumberOfEntries]
Global $xIntervalSave[$aNumberOfEntries]
Global $xURL[$aNumberOfEntries]
Global $xFileNameOriginal[$aNumberOfEntries]
Global $xFileNameResized[$aNumberOfEntries]
Global $xUserID[$aNumberOfEntries]
Global $xPwd[$aNumberOfEntries]
Global $xFTPPort[$aNumberOfEntries]
Global $xFTPURL[$aNumberOfEntries]
Global $xFTPFolder[$aNumberOfEntries]
Global $xResizeImageYN[$aNumberOfEntries]
Global $xResizeImageSize[$aNumberOfEntries]
Global $xSaveType[$aNumberOfEntries]
Global $xFTPUploadType[$aNumberOfEntries]
Global $xSaveFileNumberYN[$aNumberOfEntries]
Global $xSaveFolder[$aNumberOfEntries]
Global $xSaveMonthFolderYN[$aNumberOfEntries]
For $x = 0 To ($aNumberOfEntries - 1)
$xNotes[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Note (optional for comment in this config file) ###", "Camera " & $x + 1)
$xCameraEnableYN[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Camera Enabled (yes/no) ###", "no")
$xIntervalFTP[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Number of seconds between FTP uploads (5-86400) ###", "60")
$xIntervalSave[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Number of seconds between archive images (5-86400) ###", "60")
$xURL[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Image URL from camera (ex. http://192.168.1.5/snap.jpeg) ###", "http://192.168.1.5/snap.jpeg")
$xFileNameOriginal[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Full-size image filename (ex. camerawest.jpg) ###", "Camera" & $x + 1 & "_Full.jpg")
$xFileNameResized[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Resized image filename (leave blank if not resizing image) ###", "Camera" & $x + 1 & "_853x480.jpg")
$xFTPURL[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP URL (for Wunderground, use webcam.wunderground.com) ###", "webcam.wunderground.com")
$xFTPFolder[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP folder (for Wunderground, leave blank) ###", "")
$xUserID[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP userName (for Wunderground, use camera ID, ex. WU_7883133CAM3) ###", "")
$xPwd[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP password (for Wunderground, use key, ex. QqOQqKRy) ###", "")
$xFTPPort[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP port ###", "21")
$xResizeImageYN[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Create resize image? (yes/no) ###", "no")
$xResizeImageSize[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Resize image size: (ex. 1280x720) ###", "853x480")
$xSaveType[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Archive image: (F)ull-size (R)esized (B)oth (N)one (FRBN)###", "F")
$xFTPUploadType[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP Upload image: (F)ull-size (R)esized (B)oth (N)one (FRBN)###", "N")
$xSaveFileNumberYN[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "For archived images filename, use sequential numbers (i.e. 00000-99999) instead of date? (yes/no) ###", "no")
$xSaveFolder[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Save Folder for archived image(s) ###", @ScriptDir & "\Images\")
$xSaveFolder[$x] = _RemoveTrailingSlash($xSaveFolder[$x]) & "\"
$xSaveMonthFolderYN[$x] = IniRead($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Save images in folder by month (ex 2023-01)? (yes/no) ###", "yes")
DirCreate($xSaveFolder[$x])
If $xSaveMonthFolderYN = "yes" Then DirCreate($xSaveFolder[$x])
If $xResizeImageSize[$x] <> "" Then
Local $xImageSplit = StringSplit($xResizeImageSize[$x], "x", 2)
If StringInStr($xResizeImageSize[$x], "x") = 0 Or UBound($xImageSplit) <> 2 Then LogWrite("[Error] Resize image dimension for camera " & $x + 1 & " formated improperly. [" & $xResizeImageSize[$x] & "]")
EndIf
If $xIntervalFTP[$x] < 5 Then $xIntervalFTP[$x] = 5
If $xIntervalFTP[$x] > 86400 Then $xIntervalFTP[$x] = 86400
If $xIntervalSave[$x] < 5 Then $xIntervalSave[$x] = 5
If $xIntervalSave[$x] > 86400 Then $xIntervalSave[$x] = 86400
Next
Return $tChanged
EndFunc ;==>ReadIni
Func WriteINI()
FileDelete($aIniFile)
IniWrite($aIniFile, " --------------- " & StringUpper($aUtilName) & " --------------- ", "Number of cameras/files to manage (1-100) ###", $aNumberOfEntries)
FileWriteLine($aIniFile, "(Changes to the number above will require restarting the program so that it can add or remove entries)")
FileWriteLine($aIniFile, "")
IniWrite($aIniFile, " --------------- " & StringUpper($aUtilName) & " OPTIONS --------------- ", "Log folder ###", $aFolderLog)
IniWrite($aIniFile, " --------------- " & StringUpper($aUtilName) & " OPTIONS --------------- ", "Images temp folder ###", $aFolderImage)
IniWrite($aIniFile, " --------------- " & StringUpper($aUtilName) & " OPTIONS --------------- ", "Log Level 1-All, 2-Fails, 3-None (1-3) ###", $aLogLevel)
IniWrite($aIniFile, " --------------- " & StringUpper($aUtilName) & " OPTIONS --------------- ", "Check for updates at program start? (yes/no) ###", $aUtilCheckForUpdateYN)
IniWrite($aUtilCFGFile, "CFG", "Previous number of entries ###", $aNumberOfEntries)
For $x = 0 To ($aNumberOfEntries - 1)
FileWriteLine($aIniFile, "")
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Note (optional for comment in this config file) ###", $xNotes[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Camera Enabled (yes/no) ###", $xCameraEnableYN[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Number of seconds between FTP uploads (5-86400) ###", $xIntervalFTP[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Number of seconds between archive images (5-86400) ###", $xIntervalSave[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Image URL from camera (ex. http://192.168.1.5/snap.jpeg) ###", $xURL[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Full-size image filename (ex. camerawest.jpg) ###", $xFileNameOriginal[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Resized image filename (leave blank if not resizing image) ###", $xFileNameResized[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP URL (for Wunderground, use webcam.wunderground.com) ###", $xFTPURL[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP folder (for Wunderground, leave blank) ###", $xFTPFolder[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP userName (for Wunderground, use camera ID, ex. WU_7883133CAM3) ###", $xUserID[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP password (for Wunderground, use key, ex. QqOQqKRy) ###", $xPwd[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP port ###", $xFTPPort[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Create resize image? (yes/no) ###", $xResizeImageYN[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Resize image size: (ex. 1280x720) ###", $xResizeImageSize[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Archive image: (F)ull-size (R)esized (B)oth (N)one (FRBN)###", $xSaveType[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "FTP Upload image: (F)ull-size (R)esized (B)oth (N)one (FRBN)###", $xFTPUploadType[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "For archived images filename, use sequential numbers (i.e. 00000-99999) instead of date? (yes/no) ###", $xSaveFileNumberYN[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Save Folder for archived image(s) ###", $xSaveFolder[$x])
IniWrite($aIniFile, " --------------- CAMERA " & $x + 1 & " --------------- ", "Save images in folder by month (ex 2023-01)? (yes/no) ###", $xSaveMonthFolderYN[$x])
Next
EndFunc ;==>WriteINI
Func FTPFiles($tFile, $tFTP_Folder, $tFTP_URL, $tFTP_UserName, $tFPT_Pwd, $tFTP_Port)
Local $hFTPOpen = _FTP_Open("website")
Local $hFTPConn = _FTP_Connect($hFTPOpen, $tFTP_URL, $tFTP_UserName, $tFPT_Pwd, "", $tFTP_Port)
Local $hFTPDir = _FTP_DirSetCurrent($hFTPConn, $tFTP_Folder)
Local $xFileName = _PathSplit($tFile, "", "", "", "")
Local $tFileName = $xFileName[3] & $xFileName[4]
_FTP_FilePut($hFTPConn, $tFile, $tFileName)
Local $tERR = @error
$tFTPClose = _FTP_Close($hFTPOpen)
Return $tERR
EndFunc ;==>FTPFiles
Func LogWrite($Msg, $msgdebug = -1)
$aLogFile = $aFolderLog & $aUtilName & "_Log_" & @YEAR & "-" & @MON & "-" & @MDAY & ".txt"
Local $tFileSize = FileGetSize($aLogFile)
If $tFileSize > 10000000 Then
FileMove($aLogFile, $aFolderLog & $aUtilName & "_Log_" & @YEAR & "-" & @MON & "-" & @MDAY & "-Part1.txt")
FileWriteLine($aLogFile, _NowCalc() & " Log File Split. First file:" & $aFolderLog & $aUtilName & "_Log_" & @YEAR & "-" & @MON & "-" & @MDAY & "-Part1.txt")
EndIf
If $tFileSize > 10000000 Then FileWriteLine($aLogFile, _NowCalc() & " Log File Split. First file:" & $aFolderLog & $aUtilName & "_LogFull_" & @YEAR & "-" & @MON & "-" & @MDAY & "-Part1.txt")
If $Msg <> "" Then FileWriteLine($aLogFile, _NowCalc() & " " & $Msg)
EndFunc ;==>LogWrite
Func _ImageResizer($tFileBefore, $tFileAfter, $tWidth = 16, $tHeight = 16) ; By Phoenix125.com
_GDIPlus_Startup()
Local $GDIpBmpLarge, $GDIpBmpResized, $GDIbmp
$GDIpBmpLarge = _GDIPlus_ImageLoadFromFile($tFileBefore)
$GDIpBmpResized = _GDIPlus_ImageResize($GDIpBmpLarge, $tWidth, $tHeight)
_GDIPlus_ImageSaveToFile($GDIpBmpResized, $tFileAfter)
_GDIPlus_ImageDispose($GDIpBmpLarge)
_GDIPlus_ImageDispose($GDIpBmpResized)
_GDIPlus_Shutdown()
EndFunc ;==>_ImageResizer
Func _RestartProgram() ; By UP_NORTH
If @Compiled = 1 Then
Run(FileGetShortName(@ScriptFullPath))
Else
Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
EndIf
Exit
EndFunc ;==>_RestartProgram
Func _Splash($tTxt, $tTime = 0, $tWidth = 400, $tHeight = 125)
Local $tPID = SplashTextOn($aUtilName, $tTxt, $tWidth, $tHeight, -1, -1, $DLG_MOVEABLE, "")
If $tTime > 0 Then
Sleep($tTime)
SplashOff()
EndIf
Return $tPID
EndFunc ;==>_Splash
Func ReadCFG()
Local $iIniFail = 0
Local $iniCheck = ""
Local $aChar[3]
For $i = 1 To 13
$aChar[0] = Chr(Random(97, 122, 1)) ;a-z
$aChar[1] = Chr(Random(48, 57, 1)) ;0-9
$iniCheck &= $aChar[Random(0, 1, 1)]
Next
Global $aCFGLastVersion = IniRead($aUtilCFGFile, "CFG", "aCFGLastVersion", $iniCheck)
Global $aCFGLastVerNumber = IniRead($aUtilCFGFile, "CFG", "aCFGLastVerNumber", $iniCheck)
If $iniCheck = $aCFGLastVersion Then
$aCFGLastVersion = $aUtilVersion
IniWrite($aUtilCFGFile, "CFG", "aCFGLastVersion", $aCFGLastVersion)
EndIf
If $iniCheck = $aCFGLastVerNumber Then
$aCFGLastVerNumber = $aUtilVerNumber
IniWrite($aUtilCFGFile, "CFG", "aCFGLastVerNumber", $aCFGLastVerNumber)
EndIf
IniWrite($aUtilCFGFile, "CFG", "aCFGLastVersion", $aUtilVersion)
IniWrite($aUtilCFGFile, "CFG", "aCFGLastVerNumber", $aUtilVerNumber)
EndFunc ;==>ReadCFG
Func TrayAbout()
MsgBox($MB_SYSTEMMODAL, $aUtilName, $aUtilName & @CRLF & "Version: " & $aUtilVersion & @CRLF & @CRLF & "Install Path: " & @ScriptDir & @CRLF & @CRLF & "Discord: http://discord.gg/EU7pzPs" & @CRLF & "Website: http://www.phoenix125.com", 15)
EndFunc ;==>TrayAbout
Func TrayUpdateUtilCheck()
UtilUpdate($aUtilUpdateLinkVer, $aUtilUpdateLinkDL, $aUtilVersion, $aUtilName, 0, "show")
SplashOff()
EndFunc ;==>TrayUpdateUtilCheck
Func TrayRestartUtil()
_RestartUtil()
EndFunc ;==>TrayRestartUtil
Func TrayOpenReadMe()
ShellExecute($aUtilReadMeLink)
EndFunc ;==>TrayOpenReadMe
Func TrayOpenLog()
ShellExecute($aFolderLog & $aUtilName & "_Log_" & @YEAR & "-" & @MON & "-" & @MDAY & ".txt")
EndFunc ;==>TrayOpenLog
Func TrayOpenConfig()
_GUI_Config()
EndFunc ;==>TrayOpenConfig
Func TrayOpenImageFolder()
ShellExecute($aFolderImage & "\")
EndFunc ;==>TrayOpenImageFolder
Func TrayUpdatePause()
MsgBox($MB_OK, $aUtilName, $aUtilName & " Paused. Press OK to resume.")
EndFunc ;==>TrayUpdatePause
Func TrayExit()
If WinExists($W_ConfigWindow) Then GUIDelete($W_ConfigWindow)
LogWrite("----- ===== " & $aUtilName & " exited ===== -----")
MsgBox(0, $aUtilName, "Thank you!" & @CRLF & @CRLF & "For more programs, visit phoenix125.com", 15)
Exit
EndFunc ;==>TrayExit
Func CreateStartupBatchFile()
Global $aServerBatchFile = @ScriptDir & "\_start_" & $aUtilName & ".bat"
If @AutoItX64 = 1 Then
Global $aUtilExe = $aUtilName & "_" & $aUtilVersion & "_64-bit(x64).exe"
Else
Global $aUtilExe = $aUtilName & "_" & $aUtilVersion & ".exe"
EndIf
FileDelete($aServerBatchFile)
FileWrite($aServerBatchFile, '@echo off' & @CRLF & 'START "' & $aUtilName & '" "' & @ScriptDir & '\' & $aUtilExe & '"' & @CRLF & "EXIT")
EndFunc ;==>CreateStartupBatchFile
Func _RestartUtil($fQuickRebootTF = True, $tAdmin = False) ; Thanks Yashied! https://www.autoitscript.com/forum/topic/111215-restart-udf/
Local $Pid
Local $xArray[13]
$xArray[0] = '@echo off'
$xArray[1] = 'echo --------------------------------------------'
$xArray[2] = 'echo Waiting 5 seconds for shutdown to complete'
$xArray[3] = 'echo --------------------------------------------'
$xArray[4] = 'timeout 5'
$xArray[5] = 'start "Starting ' & $aUtilName & '" "' & $aServerBatchFile & '"'
$xArray[6] = 'echo --------------------------------------------'
$xArray[7] = 'echo ' & $aUtilName & ' started . . .'
$xArray[8] = 'echo --------------------------------------------'
$xArray[9] = 'timeout 3'
$xArray[10] = 'exit'
Local $tBatFile = $aFolderTemp & $aUtilName & "_Delay_Restart.bat"
FileDelete($tBatFile)
_FileWriteFromArray($tBatFile, $xArray)
If @Compiled Then
If $tAdmin Then
ShellExecute($tBatFile, "", "", "runas")
Else
$Pid = Run($tBatFile, "", @SW_HIDE)
EndIf
Else
If $tAdmin Then
_Splash("Run as administrator selected", 2000)
ShellExecute(@AutoItExe & ' "' & @ScriptFullPath & '" ' & $CmdLineRaw, "", "", "runas")
Else
$Pid = Run(@AutoItExe & ' "' & @ScriptFullPath & '" ' & $CmdLineRaw, @ScriptDir, Default, 1)
EndIf
If @error Then
Return SetError(@error, 0, 0)
EndIf
StdinWrite($Pid, @AutoItPID)
EndIf
Sleep(50)
_ExitUtil()
EndFunc ;==>_RestartUtil
Func _ExitUtil()
Exit
EndFunc ;==>_ExitUtil
Func _LettersOnly($tTxt)
Return StringRegExpReplace($tTxt, "[^a-z]", "")
EndFunc ;==>_LettersOnly
Func UtilUpdate($tLink, $tDL, $tUtil, $tUtilName, $tSplash = 0, $tUpdate = "show", $tShowStartupTextYN = "no")
$tUtilUpdateAvailableTF = False
If $tUpdate = "show" Then
If $tShowStartupTextYN = "yes" Then
Local $tTxt = $aStartText & "Checking for updates."
Else
Local $tTxt = "Checking for updates."
EndIf
If $tSplash > 0 Then
ControlSetText($tSplash, "", "Static1", $tTxt)
Else
$tSplash = _Splash($tTxt)
EndIf
EndIf
Local $tVer[2]
Local $sFilePath = $aFolderTemp & $aUtilName & "_latest_ver.tmp"
$iGet = _InetGetMulti(20, $sFilePath, $tLink)
If $iGet = "Error" Then
LogWrite(" [Util] Update check failed to download latest version: " & $tLink)
If $tUpdate = "show" Then
If $tShowStartupTextYN = "yes" Then
Local $tTxt = $aStartText & "Update check failed." & @CRLF & "Please try again later."
Else
Local $tTxt = "Update check failed." & @CRLF & "Please try again later."
EndIf
If $tSplash > 0 Then
ControlSetText($tSplash, "", "Static1", $tTxt)
Else
_Splash($tTxt)
EndIf
Sleep(4000)
EndIf
Else
$tVer = StringSplit($iGet, "^", 2)
If UBound($tVer) < 2 Then Return False
Local $tTxt1 = ReplaceCRLF(ReplaceCRwithCRLF($tVer[1]))
If $tVer[0] = $tUtil Then
$tUtilUpdateAvailableTF = False
LogWrite(" [Util] " & $tUtilName & " up to date. Version: " & $tVer[0], " [Util] " & $tUtilName & " up to date. Version : " & $tVer[0] & ", Notes : " & $tTxt1)
If FileExists($aUtilUpdateFile) Then FileDelete($aUtilUpdateFile)
If $tUpdate = "show" Then
If $tShowStartupTextYN = "yes" Then
Local $tTxt = $aStartText & "No update available." & @CRLF & "Installed version: " & $tUtil & @CRLF & "Latest version: " & $tVer[0]
Else
Local $tTxt = "No update available." & @CRLF & @CRLF & "Installed version: " & $tUtil & @CRLF & "Latest version: " & $tVer[0]
EndIf
If $tSplash > 0 Then
ControlSetText($tSplash, "", "Static1", $tTxt)
Else
_Splash($tTxt)
EndIf
Sleep(2000)
EndIf
Else
$tUtilUpdateAvailableTF = True
LogWrite("[Update] !!! New " & $aUtilName & " update available. Installed version: " & $tUtil & ", Latest version: " & $tVer[0], "[Update] New " & $aUtilName & _
" update available. Installed version: " & $tUtil & ", Latest version: " & $tVer[0] & ", Notes: " & $tTxt1)
FileWrite($aUtilUpdateFile, _NowCalc() & " [Util] New " & $aUtilName & " update available. Installed version: " & $tUtil & ", Latest version: " & $tVer[0] & ", Notes: " & $tTxt1)
If ($tUpdate = "show") Or ($tUpdate = "auto") Then
SplashOff()
If ($tUpdate = "Auto") And ($aUpdateAutoUtil = "yes") Then
Local $tMB = 6
Else
Local $tMB = MsgBox($MB_YESNOCANCEL, $aUtilName, "New " & $aUtilName & " update available. " & @CRLF & "Installed version: " & $tUtil & @CRLF & "Latest version: " & $tVer[0] & @CRLF & @CRLF & _
"Notes: " & @CRLF & $tVer[1] & @CRLF & @CRLF & _
"Click (YES) to download update to " & @CRLF & @ScriptDir & @CRLF & _
"Click (NO) to stop checking for updates." & @CRLF & _
"Click (CANCEL) to skip this update check.", 15)
EndIf
If $tMB = 6 Then
_Splash(" Downloading latest version of " & @CRLF & $tUtilName)
Local $tZIP = @ScriptDir & "\" & $tUtilName & "_" & $tVer[0] & ".zip"
If FileExists($tZIP) Then
FileDelete($tZIP)
EndIf
If FileExists($tUtilName & "_" & $tVer[0] & ".exe") Then
FileDelete($tUtilName & "_" & $tVer[0] & ".exe")
EndIf
If FileExists($tUtilName & "_" & $tVer[0] & "_64-bit(x64).exe") Then
FileDelete($tUtilName & "_" & $tVer[0] & "_64-bit(x64).exe")
EndIf
If FileExists(@ScriptDir & "\readme.txt") Then
FileDelete(@ScriptDir & "\readme.txt")
EndIf
InetGet($tDL, $tZIP, 1)
_ExtractZipAll($tZIP, @ScriptDir)
If Not FileExists(@ScriptDir & "\" & $tUtilName & "_" & $tVer[0] & ".exe") Then
LogWrite("[Update] ERROR! " & $tUtilName & ".exe download failed.")
SplashOff()
$tMB = MsgBox($MB_OKCANCEL, $aUtilName, "Utility update download failed . . . " & @CRLF & "Go to """ & $tLink & """ to download latest version." & @CRLF & @CRLF & "Click (OK), (CANCEL), or wait 60 seconds, to resume current version.", 60)
Else
SplashOff()
If ($tUpdate = "Auto") And ($aUpdateAutoUtil = "yes") Then
$tMB = MsgBox($MB_OKCANCEL, $aUtilName, "Auto utility update download complete. . . " & @CRLF & @CRLF & "Click (OK) to run new version or wait 60 seconds (servers will remain running) OR" & @CRLF & "Click (CANCEL) to resume current version.", 60)
If $tMB = 1 Then ; OK
ElseIf $tMB = -1 Then
$tMB = 1 ; OK
ElseIf $tMB = 2 Then ; CANCEL
EndIf
Else
$tMB = MsgBox($MB_OKCANCEL, $aUtilName, "Utility update download complete. . . " & @CRLF & @CRLF & "Click (OK) to run new version (servers will remain running) OR" & @CRLF & "Click (CANCEL), or wait 15 seconds, to resume current version.", 15)
EndIf
If $tMB = 1 Then
LogWrite("[Update] Update download complete. Shutting down current version and starting new version. Initiated by User or Auto Update.")
Local $xArray[13]
$xArray[0] = '@echo off'
$xArray[1] = 'echo --------------------------------------------'
$xArray[2] = 'echo Waiting 5 seconds for shutdown to complete'
$xArray[3] = 'echo --------------------------------------------'
$xArray[4] = 'timeout 5'
If @AutoItX64 = 1 Then
$xArray[5] = 'start "Starting ' & $aUtilName & '" "' & @ScriptDir & "\" & $tUtilName & "_" & $tVer[0] & "_64-bit(x64).exe" & '"'
Else
$xArray[5] = 'start "Starting ' & $aUtilName & '" "' & @ScriptDir & "\" & $tUtilName & "_" & $tVer[0] & ".exe" & '"'
EndIf
$xArray[6] = 'echo --------------------------------------------'
$xArray[7] = 'echo ' & $aUtilName & ' started . . .'
$xArray[8] = 'echo --------------------------------------------'
$xArray[9] = 'timeout 3'
$xArray[10] = 'exit'
Local $tBatFile = $aFolderTemp & $aUtilName & "_Delay_Restart.bat"
FileDelete($tBatFile)
_FileWriteFromArray($tBatFile, $xArray)
If FileExists($tBatFile) Then
Run($tBatFile)
Else
Run(@ScriptDir & "\" & $tUtilName & "_" & $tVer[0] & ".exe")
EndIf
Exit
Else
LogWrite("[Update] Update download complete. Per user request, continuing to run current version. Resuming utility . . .")
_Splash("Update check canceled by user." & @CRLF & "Resuming utility . . .", 2000)
EndIf
EndIf
ElseIf $tMB = 7 Then
$aUtilCheckForUpdateYN = "no"
IniWrite($aIniFile, " --------------- " & StringUpper($aUtilName) & " OPTIONS --------------- ", "Check for updates at program start? (yes/no) ###", $aUtilCheckForUpdateYN)
LogWrite("[Update] " & "Update check at startup disabled. To enable, change [Check for updates at program start? (yes/no) ###=yes] in the config.")
_Splash("Update check at startup disabled." & @CRLF & "To enable update check, change" & @CRLF & "[Check for updates at program start? (yes/no) ###=yes]" & @CRLF & "in the config.", 5000, 500)
ElseIf $tMB = 2 Then
LogWrite("[Update] Update check canceled by user. Resuming utility . . .")
_Splash("Update check canceled by user." & @CRLF & "Resuming utility . . .", 2000)
EndIf
EndIf
EndIf
EndIf
FileDelete($sFilePath)
Return $tUtilUpdateAvailableTF
EndFunc ;==>UtilUpdate
Func _InetGetMulti($tCnt, $tFile, $tLink1, $tLink2 = "0")
FileDelete($tFile)
Local $i = 0
Local $tTmp1 = InetGet($tLink1, $tFile, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
Do
Sleep(100)
$i += 1
Until InetGetInfo($tTmp1, $INET_DOWNLOADCOMPLETE) Or $i = $tCnt
InetClose($tTmp1)
If $i = $tCnt And $tLink2 <> "0" Then
$tTmp2 = InetGet($tLink2, $tFile, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
Do
Sleep(100)
$i += 1
Until InetGetInfo($tTmp2, $INET_DOWNLOADCOMPLETE) Or $i = $tCnt
InetClose($tTmp2)
EndIf
Local $hFileOpen = FileOpen($tFile, 0)
Local $hFileRead = FileRead($hFileOpen, 100000000)
If $hFileOpen = -1 Then
InetClose($tTmp1)
Sleep(200)
FileClose($hFileOpen)
Local $hFileRead = _INetGetSource($tLink1)
If @error Then
If $tLink2 <> "0" Then
$hFileRead = _INetGetSource($tLink2)
If @error Then
Return "Error" ; Error
Else
FileClose($hFileOpen)
FileDelete($tFile)
FileWrite($tFile, $hFileRead)
EndIf
Else
Return True ; Error
EndIf
Else
FileClose($hFileOpen)
FileDelete($tFile)
FileWrite($tFile, $hFileRead)
EndIf
Else
FileClose($hFileOpen)
EndIf
Return $hFileRead ; No error
EndFunc ;==>_InetGetMulti
Func ReplaceCRLF($tMsg0)
Return StringReplace($tMsg0, @CRLF, "|")
EndFunc ;==>ReplaceCRLF
Func ReplaceCRwithCRLF($sString) ; Initial Regular expression by Melba23 with a new suggestion by Ascend4nt and modified By guinness.
Return StringRegExpReplace($sString, '(*BSR_ANYCRLF)\R', @CRLF) ; Idea by Ascend4nt
EndFunc ;==>ReplaceCRwithCRLF
Func _RemoveTrailingSlash($aString)
Local $bString = StringRight($aString, 1)
If $bString = "\" Then $aString = StringTrimRight($aString, 1)
Return $aString
EndFunc ;==>_RemoveTrailingSlash
Func _ExtractZipAll($sZipFile, $sDestinationFolder, $sFolderStructure = "")
Local $i
Do
$i += 1
$sTempZipFolder = @TempDir & "\Temporary Directory " & $i & " for " & StringRegExpReplace($sZipFile, ".*\\", "")
Until Not FileExists($sTempZipFolder) ; this folder will be created during extraction
Local $oShell = ObjCreate("Shell.Application")
If Not IsObj($oShell) Then
Return SetError(1, 0, 0) ; highly unlikely but could happen
EndIf
Local $oDestinationFolder = $oShell.NameSpace($sDestinationFolder)
If Not IsObj($oDestinationFolder) Then
DirCreate($sDestinationFolder)
EndIf
Local $oOriginFolder = $oShell.NameSpace($sZipFile & "\" & $sFolderStructure) ; FolderStructure is overstatement because of the available depth
If Not IsObj($oOriginFolder) Then
Return SetError(3, 0, 0) ; unavailable location
EndIf
Local $oOriginFile = $oOriginFolder.Items() ;get all items
If Not IsObj($oOriginFile) Then
Return SetError(4, 0, 0) ; no such file in ZIP file
EndIf
$oDestinationFolder.CopyHere($oOriginFile, 20) ; 20 means 4 and 16, replaces files if asked
DirRemove($sTempZipFolder, 1) ; clean temp dir
Return 1 ; All OK!
EndFunc ;==>_ExtractZipAll
Func _GUI_Config()
If Not WinExists($W_ConfigWindow) Then
Opt("GUIResizeMode", $GUI_DOCKLEFT + $GUI_DOCKTOP)
#Region ### START Koda GUI section ### Form=K:\AutoIT\_MyProgs\UniFiCameraImageArchiverFTPUploader\Koda GUIs\UniFiCameraImage_v1.1(b3).kxf
Local $gBXstart = 58, $gBYstart = 43, $gBGapX = 1, $gBGapY = 1, $gBinaRow = 25, $gBW = 27, $gBH = 25, $gY = -20 ; Baseline Parameters
For $i = 0 To ($aNumberOfEntries - 1)
If Mod($i + 1, $gBinaRow) = 0 And $i < ($aNumberOfEntries - 1) Then $gY += $gBH + $gBGapY ; Lowers tab window by number of grid tab rows.
Next
Global $tY = $gY
$W_ConfigWindow = GUICreate("UniFi Camera Image Archiver FTP Uploader", 900, 716 + $tY, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_THICKFRAME))
GUISetIcon($aIconFile, 99)
GUISetBkColor($cBackgroundGray)
_DisableCloseButton($W_ConfigWindow)
GUISetOnEvent($GUI_EVENT_CLOSE, "W_ConfigWindowClose")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "W_ConfigWindowMinimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "W_ConfigWindowMaximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "W_ConfigWindowRestore")
Global $G_B_CameraButtons[$aNumberOfEntries]
Local $gBXnow = $gBXstart, $gBYnow = $gBYstart
If $aNumberOfEntries < 26 Then
Local $gBYLabel = $gBYstart - 5
Else
Local $gBYLabel = $gBYstart
EndIf
Global $G_L_CameraSelect = GUICtrlCreateLabel("Select", 12, $gBYLabel, 44, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetColor(-1, $cGreenLime)
GUICtrlSetOnEvent(-1, "F_L_UploadFreqCommentClick")
Global $G_L_CameraSelect = GUICtrlCreateLabel("Camera:", 12, $gBYLabel + 17, 44, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetColor(-1, $cGreenLime)
GUICtrlSetOnEvent(-1, "F_L_UploadFreqCommentClick")
For $i = 0 To ($aNumberOfEntries - 1)
$G_B_CameraButtons[$i] = GUICtrlCreateButton($i + 1, $gBXnow, $gBYnow, $gBW, $gBH)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetOnEvent(-1, "G_B_CameraClicked")
If Mod($i + 1, $gBinaRow) = 0 Then
$gBYnow += $gBH + $gBGapY ; Lowers tab window by number of grid tab rows.
$gBXnow = $gBXstart
Else
$gBXnow += $gBW + $gBGapX
EndIf
Next
Global $B_AddCamera = GUICtrlCreateButton("+1 Cam", 802, $gBYstart, $gBW + 20, $gBH)
GUICtrlSetBkColor(-1, $cYellowHighlight)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Add a camera. Note: Program will be restarted.")
GUICtrlSetOnEvent(-1, "B_AddCameraClick")
Global $B_RemoveCamera = GUICtrlCreateButton("-1 Cam", 802 + $gBW + 20 + $gBGapX, $gBYstart, $gBW + 20, $gBH)
GUICtrlSetBkColor(-1, $cYellowHighlight)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Remove the LAST camera. Note: Program will be restarted.")
GUICtrlSetOnEvent(-1, "B_RemoveCamera")
Global $G_ConfigWindow = GUICtrlCreateGroup("", 4, 85 + $tY, 891, 626)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $G_W_B_Close = GUICtrlCreateButton("X", 865, 5, 27, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Close config window. Program will continue to run.")
GUICtrlSetBkColor(-1, $cRedFaded)
GUICtrlSetOnEvent(-1, "B_Close")
Global $G_FTP = GUICtrlCreateGroup("FTP", 19, 407 + $tY, 859, 165)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $F_L_UploadFreq = GUICtrlCreateLabel("Upload frequency", 312, 430 + $tY, 88, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "How often images are uploaded (in seconds)")
GUICtrlSetColor(-1, $cYellowHighlight)
GUICtrlSetOnEvent(-1, "F_L_UploadFreqClick")
Global $F_L_URL = GUICtrlCreateLabel("URL", 219, 457 + $tY, 26, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "URL for FTP uploaded image. For Wunderground, use webcam.wunderground.com")
GUICtrlSetColor(-1, $cYellowHighlight)
GUICtrlSetOnEvent(-1, "F_L_URLClick")
Global $F_L_URLComment = GUICtrlCreateLabel("for Wunderground, use webcam.wunderground.com", 486, 459 + $tY, 250, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "URL for FTP uploaded image. For Wunderground, use webcam.wunderground.com")
GUICtrlSetColor(-1, $cGreenLime)
GUICtrlSetOnEvent(-1, "F_L_URLCommentClick")
Global $F_L_UploadFreqComment = GUICtrlCreateLabel("seconds (5-86400)", 485, 433 + $tY, 100, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "How often images are uploaded (in seconds)")
GUICtrlSetColor(-1, $cGreenLime)
GUICtrlSetOnEvent(-1, "F_L_UploadFreqCommentClick")
Global $F_I_UploadFreq = GUICtrlCreateInput("F_I_UploadFreq", 405, 428 + $tY, 75, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "How often images are uploaded (in seconds)")
GUICtrlSetOnEvent(-1, "F_I_UploadFreqChange")
Global $F_U_UploadFreq = GUICtrlCreateUpdown($F_I_UploadFreq)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "How often images are uploaded (in seconds)")
GUICtrlSetLimit(-1, 86400, 5)
GUICtrlSetOnEvent(-1, "F_U_UploadFreqChange")
Global $F_I_URL = GUICtrlCreateInput("F_I_URL", 252, 454 + $tY, 229, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "URL for FTP Uploaded image. For Wunderground, use webcam.wunderground.com")
GUICtrlSetOnEvent(-1, "F_I_URLChange")
Global $F_L_Username = GUICtrlCreateLabel("Username", 218, 486 + $tY, 52, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Username for FTP account. For Wunderground, use camera ID. i.e. WU_7886163CAM3")
GUICtrlSetColor(-1, $cYellowHighlight)
GUICtrlSetOnEvent(-1, "F_L_UsernameClick")
Global $F_I_Username = GUICtrlCreateInput("", 276, 484 + $tY, 205, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Username for FTP account. For Wunderground, use camera ID. i.e. WU_7886163CAM3")
GUICtrlSetOnEvent(-1, "F_I_UsernameChange")
Global $F_L_UsernameComment = GUICtrlCreateLabel("for Wunderground, use camera ID. i.e. WU_7886163CAM3", 486, 487 + $tY, 287, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Username for FTP account. For Wunderground, use camera ID. i.e. WU_7886163CAM3")
GUICtrlSetColor(-1, $cGreenLime)
GUICtrlSetOnEvent(-1, "F_L_UsernameCommentClick")
Global $F_L_Password = GUICtrlCreateLabel("Password", 218, 512 + $tY, 50, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Password for FTP account. For Wunderground, use key. i.e. QqOQqKRy")
GUICtrlSetColor(-1, $cYellowHighlight)
GUICtrlSetOnEvent(-1, "F_L_PasswordClick")
Global $F_I_Password = GUICtrlCreateInput("", 276, 510 + $tY, 205, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Password for FTP account. For Wunderground, use key. i.e. QqOQqKRy")
GUICtrlSetOnEvent(-1, "F_I_PasswordChange")
Global $F_L_PasswordComment = GUICtrlCreateLabel("for Wunderground, use key. i.e. QqOQqKRy", 486, 513 + $tY, 212, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Password for FTP account. For Wunderground, use key. i.e. QqOQqKRy")
GUICtrlSetColor(-1, $cGreenLime)
GUICtrlSetOnEvent(-1, "F_L_PasswordCommentClick")
Global $F_L_FTPFolder = GUICtrlCreateLabel("FTP Folder", 215, 538 + $tY, 56, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "FTP folder to upload images. For Wunderground, leave blank.")
GUICtrlSetColor(-1, $cYellowHighlight)
GUICtrlSetOnEvent(-1, "F_L_FTPFolderClick")
Global $F_I_FTPFolder = GUICtrlCreateInput("", 276, 536 + $tY, 205, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "FTP folder to upload images. For Wunderground, leave blank.")
GUICtrlSetOnEvent(-1, "F_I_FTPFolderChange")
Global $F_L_FTPFolderComment = GUICtrlCreateLabel("for Wunderground, leave blank", 486, 539 + $tY, 151, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetColor(-1, $cGreenLime)
GUICtrlSetTip(-1, "FTP folder to upload images. For Wunderground, leave blank.")
GUICtrlSetOnEvent(-1, "F_L_FTPFolderCommentClick")
Global $F_C_UploadFullSize = GUICtrlCreateCheckbox("Upload Full Size Images", 34, 434 + $tY, 137, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "FTP upload full size images")
GUICtrlSetOnEvent(-1, "F_C_UploadFullSizeClick")
Global $F_C_UploadResized = GUICtrlCreateCheckbox("Upload Resized Images", 34, 454 + $tY, 130, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "FTP upload resized images")
GUICtrlSetOnEvent(-1, "F_C_UploadResizedClick")
Global $F_L_FTPPort = GUICtrlCreateLabel("FTP Port", 64, 538 + $tY, 46, 17)
GUICtrlSetColor(-1, 0xFFFF00)
GUICtrlSetOnEvent(-1, "F_L_FTPPort")
Global $F_I_FTPPort = GUICtrlCreateInput("F_I_FTPPort", 115, 536 + $tY, 71, 21)
GUICtrlSetOnEvent(-1, "F_I_FTPPortChange")
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $G_FinishGroup = GUICtrlCreateGroup("Finish", 380, 586 + $tY, 203, 61)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $B_Exit = GUICtrlCreateButton("Exit Program", 489, 607 + $tY, 80, 29)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetBkColor(-1, $cRedFaded)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Exit program. Images will NOT be archived or uploaded.")
GUICtrlSetOnEvent(-1, "B_ExitClick")
Global $B_CloseConfig = GUICtrlCreateButton("Close Config", 395, 607 + $tY, 88, 29)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $cGreenLime)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Close config window. Program will continue to run.")
GUICtrlSetOnEvent(-1, "B_CloseConfig")
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $G_OptionsGroup = GUICtrlCreateGroup("Options", 18, 586 + $tY, 349, 115)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $O_C_CheckForUpdates = GUICtrlCreateCheckbox("Check for updates at program start", 148, 611 + $tY, 201, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetOnEvent(-1, "O_C_CheckForUpdatesClick")
Global $O_G_Log = GUICtrlCreateGroup("Log", 28, 605 + $tY, 109, 83)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
Global $O_R_LogAll = GUICtrlCreateRadio("All", 50, 622 + $tY, 41, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Log all archive progress, upload progress, and other comments")
GUICtrlSetOnEvent(-1, "O_R_LogAllClick")
Global $O_R_LogFails = GUICtrlCreateRadio("Fails Only", 50, 642 + $tY, 71, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Log archive and upload failures only")
GUICtrlSetOnEvent(-1, "O_R_LogFailsClick")
Global $O_R_LogNone = GUICtrlCreateRadio("None", 50, 662 + $tY, 60, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetOnEvent(-1, "O_R_LogNoneClick")
GUICtrlSetTip(-1, "Do NOT create a log file")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $L_FooterPhoenixURL = GUICtrlCreateLabel("http://www.Phoenix125.com", 642, 652 + $tY, 168, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Click to visit http://www.phoenix125.com")
GUICtrlSetOnEvent(-1, "L_FooterPhoenixURLClick")
Global $L_FooterProgName = GUICtrlCreateLabel($aUtilName & " " & $aUtilVer, 569, 675 + $tY, 241, 20, $SS_RIGHT)
GUICtrlSetTip(-1, "Click to visit website")
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetOnEvent(-1, "L_FooterProgNameClick")
Global $P_PhoenixLogo = GUICtrlCreatePic($aFolderTemp & "phoenixlogo.jpg", 816, 635 + $tY, 60, 60)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Click to visit http://www.phoenix125.com")
GUICtrlSetOnEvent(-1, "P_PhoenixLogoClick")
Global $P_About = GUICtrlCreateIcon($aIconFile, 202, 532, 671 + $tY, 24, 24)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "About")
GUICtrlSetOnEvent(-1, "P_AboutClick")
Global $P_Discord = GUICtrlCreateIcon($aIconFile, 201, 499, 671 + $tY, 24, 24)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Discord Page")
GUICtrlSetOnEvent(-1, "P_DiscordClick")
Global $P_Discussion = GUICtrlCreateIcon($aIconFile, 203, 467, 671 + $tY, 24, 24)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "Discussion Forum")
GUICtrlSetOnEvent(-1, "P_DiscussionClick")