-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFE-ASSISTANT.bat
1426 lines (1193 loc) · 59.9 KB
/
FE-ASSISTANT.bat
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
@ECHO OFF
setlocal enabledelayedexpansion
:: Set SCRIPT_NAME to the name of this batch file script
set THIS_VERSION=2.0.02
:: Set SCRIPT_NAME to the name of this batch file script
set SCRIPT_NAME=FE-Assistant
:: Set GH_USER_NAME to your GitHub username here
set GH_USER_NAME=KSanders7070
:: Set GH_REPO_NAME to your GitHub repository name here
set GH_REPO_NAME=FE-ASSISTANT
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
TITLE !SCRIPT_NAME! (v!THIS_VERSION!)
:SetUpTempDir
:: Setting up the Temp Directory
CD /D "%temp%"
IF exist "!GH_REPO_NAME!-UDPATE" RD /S /Q "!GH_REPO_NAME!-UDPATE"
MD "!GH_REPO_NAME!-UDPATE"
CD /D "!GH_REPO_NAME!-UDPATE"
:GetLatestVerNum
:: Set Variable for the user-end of the GitHub Latest Release page.
set "GH_LATEST_RLS_PAGE=https://github.com/!GH_USER_NAME!/!GH_REPO_NAME!/releases/latest"
:: URL to fetch JSON data from GitHub API
set "URL_TO_DOWNLOAD=https://api.github.com/repos/!GH_USER_NAME!/!GH_REPO_NAME!/releases/latest"
set "LATEST_VERSION="
:RedirectLooop
if exist response.json del /Q response.json
:: Use CURL to download the JSON data
curl -s -o response.json !URL_TO_DOWNLOAD!
if not exist "response.json" (
ECHO.
ECHO.
ECHO -------
ECHO ERROR
ECHO -------
ECHO.
ECHO Something went wrong with downloading the latest release information.
ECHO.
ECHO.
ECHO Press any key to continue with this version of the batch file or
ECHO just close this window...
ECHO NOTE-I will open the releases page for you to see if there is a newer version.
PAUSE>NUL
START "" "!GH_LATEST_RLS_PAGE!"
GOTO UpdateCleanUp
)
::Check if "exceeded" is present in the JSON, if so it likely means the API Call limit has been reached.
findstr /C:"exceeded" response.json
if "%errorlevel%"=="0" (
ECHO.
ECHO.
ECHO -------
ECHO ERROR
ECHO -------
ECHO.
ECHO While trying to get the latest version number for this batch file from GitHub,
ECHO I found that the number of requests has been exceeded.
ECHO You can try again in a while.
ECHO.
ECHO.
ECHO Press any key to continue with this version of the batch file or
ECHO just close this window...
ECHO NOTE-I will open the releases page for you to see if there is a newer version.
PAUSE>NUL
START "" "!GH_LATEST_RLS_PAGE!"
GOTO UpdateCleanUp
)
:: Check if "tag_name" is present in the JSON.
findstr /C:"tag_name" response.json
if "%errorlevel%"=="0" (
:: tag_name Found in file which means there was no redirect or this is the final redirect
:: page and has the version number on it.
:: Extract the text between the second set of quotes and remove the first character (usually a lower case v).
for /f "tokens=2 delims=:" %%a in ('findstr /C:"tag_name" response.json') do (
set "LATEST_VERSION=%%~a"
set "LATEST_VERSION=!LATEST_VERSION:~3,-2!"
)
) else (
:: tag_name was not found which means that this is likely a redirect page.
:: Extract the line that has "https://api." and grab the URL between the second set of quotes.
:: Feed this URL back through the loop to see if this one redirects too. If it does, keep following until tag_name is found.
for /f "tokens=1,* delims=" %%a in ('findstr /C:"https://api." response.json') do (
set "URL_TO_DOWNLOAD=%%~a"
set "URL_TO_DOWNLOAD=!URL_TO_DOWNLOAD:~10,-2!"
)
goto RedirectLooop
)
:DoYouHaveLatest
:: If the current version matches the latest version available, contine on with normal code.
if /i "!THIS_VERSION!"=="!LATEST_VERSION!" goto UpdateCleanUp
:UpdateAvailablePrompt
cls
ECHO.
ECHO.
ECHO * * * * * * * * * * * * *
ECHO UPDATE AVAILABLE
ECHO * * * * * * * * * * * * *
ECHO.
ECHO.
ECHO GITHUB VERSION: !LATEST_VERSION!
ECHO YOUR VERSION: !THIS_VERSION!
ECHO.
ECHO.
ECHO.
ECHO CHOICES:
ECHO.
ECHO U - MANUALLY DOWNLOAD THE NEWEST BATCH FILE UPDATE AND USE THAT FILE.
ECHO.
ECHO C - CONTINUE USING THIS FILE.
ECHO.
ECHO.
ECHO.
SET UPDATE_CHOICE=NO_CHOICE_MADE
SET /p UPDATE_CHOICE=Please type either M, or C and press Enter:
if /I %UPDATE_CHOICE%==U GOTO UPDATE
if /I %UPDATE_CHOICE%==C GOTO UpdateCleanUp
if /I %UPDATE_CHOICE%==NO_CHOICE_MADE GOTO UpdateAvailablePrompt
:UPDATE
CLS
START "" "!GH_LATEST_RLS_PAGE!"
ECHO.
ECHO.
ECHO GO TO THE FOLLOWING WEBSITE, DOWNLOAD AND USE THE LATEST VERSION OF %~nx0
ECHO.
ECHO !GH_LATEST_RLS_PAGE!
ECHO.
ECHO Press any key to exit...
pause>nul
exit
:UpdateCleanUp
cls
CD /D "%temp%"
IF exist "!GH_REPO_NAME!-UDPATE" RD /S /Q "!GH_REPO_NAME!-UDPATE"
:: Ensures the directory is back to where this batch file is hosted.
CD /D "%~dp0"
:RestOfCode
:START
mode con: cols=140 lines=45
:: Users of this batch file should put their own faclity ID on the next line.
SET FACILITY_ID=ZLC
TITLE !SCRIPT_NAME! (v!THIS_VERSION!)-!FACILITY_ID! !VERSION_STATUS!
:HELLO
CLS
ECHO.
ECHO.
ECHO WHAT WOULD YOU LIKE TO DO?
ECHO.
ECHO.
ECHO A) CHECK FOR AN UPDATE.
ECHO.
ECHO -You are currently running v!THIS_VERSION!.
ECHO.
ECHO -This option will open the GitHub releases page for this program allowing you to
ECHO download the latest version. If you download another version of this BATCH files,
ECHO simply delete this file and run the new one.
ECHO.
ECHO.
ECHO B) !FACILITY_ID! AIRAC RELEASE PREP.
ECHO.
ECHO -Type DETAILS if you want more information on what this function does.
ECHO -If you haven't ran this script before, be sure you read this information.
ECHO.
ECHO -If "!FACILITY_ID!" is not your facility ID, please choose the "CHANGE FACILITY" option.
ECHO.
ECHO.
ECHO C) CHANGE FACILITY.
ECHO.
ECHO -If your facility is NOT "!FACILITY_ID!", select this option.
ECHO.
ECHO.
ECHO D) HELP.
ECHO.
ECHO -Delete all previously saved directories and information.
ECHO.
ECHO -Edit the GeoJSON list, renaming list, or the CRC defaults.
ECHO.
ECHO.
SET WHAT_T0_DO_CHOICE=NO_INPUT_BY_USER
SET /P WHAT_T0_DO_CHOICE=Type associated letter option or type DETAILS, and press Enter:
if /i "!WHAT_T0_DO_CHOICE!"=="A" GOTO CHECKUPDATE
if /i "!WHAT_T0_DO_CHOICE!"=="B" GOTO AiracReleaseOption
if /i "!WHAT_T0_DO_CHOICE!"=="DETAILS" GOTO DETAILS
if /i "!WHAT_T0_DO_CHOICE!"=="C" GOTO SetFacilityID
if /i "!WHAT_T0_DO_CHOICE!"=="D" GOTO HELP
ECHO.
ECHO *** !WHAT_T0_DO_CHOICE! *** is NOT a recognized response. Try again...
echo.
ECHO Press any key to try again...
PAUSE>NUL
goto HELLO
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:CHECKUPDATE
START "" https://github.com/KSanders7070/FE-ASSISTANT/releases/latest
GOTO HELLO
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:AiracReleaseOption
CLS
:PythonInstallCheck
:: Checkst to see if Python is installed and if it isn't, displays an error to the user
:: instructoring them how to install it along with opening their default web browser up to the install page.
python --version > nul 2>&1
if %errorlevel% == 0 (
echo Python is installed and available in PATH.
) else (
CALL :PythonNotInstalled
)
CLS
:LocalAppdataFolder
:: Creates a folder in the Local Appdata directory of the user if it doesn't already exist
:: in order to save previously selected directories so the user doesn't have to select the folders each time.
CD /D "%LocalAppData%"
IF NOT EXIST "!FACILITY_ID!-FE-ASSISTANT-appdata" MD "!FACILITY_ID!-FE-ASSISTANT-appdata"
SET FE_ASSISTANT_AppData_DIR=%LocalAppData%\!FACILITY_ID!-FE-ASSISTANT-appdata
:DefaultSetterManagement
:: Deleting the FEB-DefaultSetter-main folder if previously saved and then making a new setup for running the
:: Python script in the background without needing the user to have it installed in a specific directory already.
CD /D "!FE_ASSISTANT_AppData_DIR!"
IF EXIST "DefaultSetter" RD /S /Q "DefaultSetter"
MD "DefaultSetter"
SET DefaultSetter_DIR=!FE_ASSISTANT_AppData_DIR!\DefaultSetter
MD "!DefaultSetter_DIR!\DefaultSetterOutput"
SET DefaultSetter_Output_DIR=!DefaultSetter_DIR!\DefaultSetterOutput
MD "!DefaultSetter_DIR!\modules"
SET DefaultSetter_Modules_DIR=!DefaultSetter_DIR!\modules
:: Creates the DefaultSetterPrefs_DIR for later use.
SET DefaultSetterPrefs_DIR=!FE_ASSISTANT_AppData_DIR!\DefaultSetterPrefs
CALL :Make_DefaultSetter
:PreferencesHandler
:: Define the configuration file name
set "configFile=!FACILITY_ID!-FE-ASSISTANT_config.txt"
:: Initialize variables
SET "DecombinedALiasFilesDirectory=NOT_SET"
SET "CombinedALiasFilesDirectory=NOT_SET"
SET "CombinedAliasFileName=NOT_SET"
SET "BrowserMsg= "
SET "CmdMsgLine1= "
SET "CmdMsgLine2= "
:: Read configFile and assign the values to the appropriate variables for later use.
IF EXIST "!configFile!" (
for /f "tokens=1,* delims==" %%a in ('type "!configFile!"') do (
set "index1=%%a"
set "index2=%%b"
if "!index1!"=="DecombinedALiasFilesDirectory" set "DecombinedALiasFilesDirectory=!index2!"
if "!index1!"=="CombinedALiasFilesDirectory" set "CombinedALiasFilesDirectory=!index2!"
if "!index1!"=="CombinedAliasFileName" set "CombinedAliasFileName=!index2!"
)
)
:: Checks to see if any data is missing from the variables, thus requiring the user to input some information.
:: This part is simply to prepare the user for what type of prompts are coming and be prepared to do a one-time setup.
if "!DecombinedALiasFilesDirectory!"=="NOT_SET" goto MissingInformationMsg
if "!CombinedALiasFilesDirectory!"=="NOT_SET" goto MissingInformationMsg
if "!CombinedAliasFileName!"=="NOT_SET" goto MissingInformationMsg
if not exist "!DefaultSetterPrefs_DIR!" goto MissingInformationMsg
:: If we have reached this point, all information has been found and saved to the appropriate variables and no warnign is required.
goto AllIinfoFound
:MissingInformationMsg
echo.
echo.
echo Looks like either this is your first time setting up this batch file or there was an update and
echo we are missing some information about your system or facility preferences.
echo.
echo The following few prompts will ask you for some information, and then we will store that information
echo for the next time you run this script so you don't have to do this set-up every time.
echo.
echo.
echo ---------------------
echo WARNING
echo ---------------------
echo.
echo READ THE PROMPTS VERY CAREFULLY, as there is very little error checking!
echo.
echo.
pause
CLS
:: If the configFile didn't have any value for the following variables, that means we need
:: to ask the user to select the directory or some other input and save it for future use.
IF "!DecombinedALiasFilesDirectory!"=="NOT_SET" (
SET "BrowserMsg=Select the Decombined ALias file host folder"
SET "CmdMsgLine1=Select the folder that hosts the the DECOMBINED alias files meant for editing."
SET "CmdMsgLine2=This does NOT mean the COMBINED, finalized alias file."
CALL :SelectDirectory
SET DecombinedALiasFilesDirectory=!SELECTED_DIRECTORY!
ECHO DecombinedALiasFilesDirectory=!SELECTED_DIRECTORY!>>!configFile!
)
IF "!CombinedALiasFilesDirectory!"=="NOT_SET" (
SET "BrowserMsg=Select the output location for the combined Alias file"
SET "CmdMsgLine1=Select the folder that you want the finalized combined alias file to be place in."
SET "CmdMsgLine2=Do NOT make this folder the same folder that hosts the decombined alias files."
CALL :SelectDirectory
SET CombinedALiasFilesDirectory=!SELECTED_DIRECTORY!
ECHO CombinedALiasFilesDirectory=!SELECTED_DIRECTORY!>>!configFile!
)
IF "!CombinedAliasFileName!"=="NOT_SET" (
ECHO.
ECHO.
ECHO What do you wish the name of the finalized Alias file to be called?"
ECHO Ex: !FACILITY_ID! Alias
ECHO.
ECHO.
SET /P CombinedAliasFileName=Type the name of the file WITHOUT an extension like .txt:
SET CombinedAliasFileName=!CombinedAliasFileName!.txt
ECHO CombinedAliasFileName=!CombinedAliasFileName!>>!configFile!
)
:: If the DefaultSetterPrefs folder doesn't exist, make one.
IF EXIST "!DefaultSetterPrefs_DIR!" goto AllIinfoFound
CALL :CreateTemplateGeojsonPrefFiles
:: If we have reached this point, all information has been found and saved to the appropriate variables and no warnign is required.
:: Begin normal AIRAC Cycle prepartion processess.
:AllIinfoFound
CLS
:BeginAiracReleasePrep
:FEBOutputDirSelect
:: Launches Windows Folder Browser window to have the user select the FE-Buddy Output folder.
:: Note-This directory is not saved in the configFile because it is more likely to change every
:: AIRAC release and adds a level of human validation.
SET "BrowserMsg=Select the FE-Buddy Output folder"
SET "CmdMsgLine1=Select the FE-Buddy Output folder."
SET "CmdMsgLine2= Note-This directory is not saved in the configFile for future runs of this script."
CALL :SelectDirectory
SET FEB_Output_DIR=!SELECTED_DIRECTORY!
:UpdateALiasFIles
:: Overwrites the decombined alias files with the coorisponding alias files from the FE-Buddy Output folder.
SET FEB_OUTPUT_ALIAS_DIR=!FEB_Output_DIR!\ALIAS
IF NOT EXIST "!FEB_OUTPUT_ALIAS_DIR!" (
SET VARIABLE_NAME=FEB_OUTPUT_ALIAS_DIR
SET DIRECTORY_NOT_FOUND=!FEB_OUTPUT_ALIAS_DIR!
CALL :DIRECTORY_NOT_FOUND
)
:: Clears the previously combined alias file or makes a new one if never previously created.
break>"!CombinedALiasFilesDirectory!\!CombinedAliasFileName!"
CD /D "!DecombinedALiasFilesDirectory!"
SET FILE_NAME_ENDING=_AIRPORT ISR.txt
CALL :FindFileName
TYPE "!FEB_OUTPUT_ALIAS_DIR!\ISR_APT.txt">"!file_name!"
SET FILE_NAME_ENDING=_NAVAID ISR.txt
CALL :FindFileName
TYPE "!FEB_OUTPUT_ALIAS_DIR!\ISR_NAVAID.txt">"!file_name!"
SET FILE_NAME_ENDING=_AIRWAY FIXES ALIAS.txt
CALL :FindFileName
TYPE "!FEB_OUTPUT_ALIAS_DIR!\AWY_ALIAS.txt">"!file_name!"
SET FILE_NAME_ENDING=_STAR DP FIXES ALIAS.txt
CALL :FindFileName
TYPE "!FEB_OUTPUT_ALIAS_DIR!\STAR_DP_Fixes_Alias.txt">"!file_name!"
SET FILE_NAME_ENDING=_FAA CHART RECALL.txt
CALL :FindFileName
TYPE "!FEB_OUTPUT_ALIAS_DIR!\FAA_CHART_RECALL.txt">"!file_name!"
SET FILE_NAME_ENDING=_TELEPHONY.txt
CALL :FindFileName
TYPE "!FEB_OUTPUT_ALIAS_DIR!\TELEPHONY.txt">"!file_name!"
:: Combine all of the newly updated decombined alias files.
type "!DecombinedALiasFilesDirectory!\*.txt">>"!CombinedALiasFilesDirectory!\!CombinedAliasFileName!"
(
echo.
echo.
)>>"!CombinedALiasFilesDirectory!\!CombinedAliasFileName!"
:PrepareVnasGeoJsons
:: Checks to see if the CRC folder exists inside the FE-Buddy Output folder that the user should have selected.
SET FEB_CRC_DIR=!FEB_Output_DIR!\CRC
IF NOT EXIST "!FEB_CRC_DIR!" (
SET VARIABLE_NAME=FEB_CRC_DIR
SET DIRECTORY_NOT_FOUND=!FEB_CRC_DIR!
CALL :DIRECTORY_NOT_FOUND
)
SET FEB_CRC_BATCH_DIR=!FEB_CRC_DIR!\vNAS BATCH UPLOAD
:: If the vNAS BATCH UPLOAD folder already exists, it is likely that this script has already
:: been ran on that selected folder and will cause issues.
IF EXIST "!FEB_CRC_BATCH_DIR!" (
SET DIRECTORY_THAT_ALREADY_EXISTS=FE-Buddy Output \CRC\vNAS BATCH UPLOAD
CALL :DirectoryAlreadyExists
)
:: Creates the vNAS BATCH UPLOAD folder inside the user selected FE-Buddy Output folder \CRC\.
CD /D "!FEB_CRC_DIR!"
:: Checks to see if there are 21 or more .geojson files in the FE-Buddy \ CRC directory.
:: If there are less, then it is likely that the script has already been ran on this directory and will cause issues.
set "fileCount=0"
for %%i in (*.geojson) do (
set /a "fileCount+=1"
)
if not !fileCount! GEQ 21 CALL :IncorrectGeoJsonAmnt
MD "!FEB_CRC_BATCH_DIR!"
CD /D "!DefaultSetterPrefs_DIR!"
:: Sets the file name of the Rename_FE-Buddy_Output_GeoJSONs.txt as a variable.
if not exist "Rename_FE-Buddy_Output_GeoJSONs.txt" (
CALL :DefaultSetterPrefEdit
)
:: Loop through each line in Rename_FE-Buddy_Output_GeoJSONs.txt
for /f "tokens=1,2 delims=," %%a in ('type "!DefaultSetterPrefs_DIR!\Rename_FE-Buddy_Output_GeoJSONs.txt"') do (
set "old_filename=%%a"
set "new_filename=%%b"
:: Rename the file
ren "!FEB_CRC_DIR!\!old_filename!" "!new_filename!"
:: Move the renamed file to the vNAS BATCH UPLOAD folder
move "!FEB_CRC_DIR!\!new_filename!" "!FEB_CRC_BATCH_DIR!\"
)
:: Runs the setdefaults.py and passes in the directories of where to find the vNAS BATCH UPLOAD files,
:: where to place the output files, and where the CRC defaults list is located.
CD /D "!DefaultSetter_DIR!"
python.exe setdefaults.py --sourcedir "!FEB_CRC_BATCH_DIR!" --outputdir "!DefaultSetter_Output_DIR!" --defaultsfile "!DefaultSetterPrefs_DIR!\CRC_GeoJSON_Defaults.txt"
:: Move files from DefaultSetting Output folder and back to the vNAS BATCH UPLOAD folder.
ECHO.
ECHO.
ECHO The following were edited and moved back the FE-Buddy vNAS BATCH UPLOAD folder:
for %%A in ("%DefaultSetter_Output_DIR%\*.geojson") do (
move "%%A" "%FEB_CRC_BATCH_DIR%"
)
:EndChecks
set TextCheckStatus=NOT_SET
set GeoJsonsCheckStatus=NOT_SET
:: Check if the .txt file exists in CombinedAliasFilesDirectory
:: If no .txt files found, set the TextCheckStatus variable to Failed.
if not exist "%CombinedAliasFilesDirectory%\*.txt" set TextCheckStatus=Failed
:: Count the number of .geojson files in FEB_CRC_BATCH_DIR
for /f %%A in ('dir /b /a-d "%FEB_CRC_BATCH_DIR%\*.geojson" ^| find /c /v ""') do set "geojson_count=%%A"
:: Check if there is at least 1 .geojson files
:: If less than 1, sets the GeoJsonsCheckStatus variable to failed.
if %geojson_count% LSS 1 set GeoJsonsCheckStatus=Failed
:: If either check or both failed, goes to EndChecksFailed function to notify the user.
If "!TextCheckStatus!"=="Failed" CALL :EndChecksFailed
If "!GeoJsonsCheckStatus!"=="Failed" CALL :EndChecksFailed
ECHO.
ECHO.
ECHO ---------
ECHO DONE
ECHO ---------
ECHO.
ECHO.
ECHO Press any key do the following:
ECHO.
ECHO -Open a web browser tab to the virtualnas.net page where you may upload the newly combined alias file.
ECHO.
ECHO -Open a web browser tab to the virtualnas.net/video-maps page where you may upload the newly edited
ECHO geojsons using the BATCH UPLOAD option.
ECHO.
ECHO -Open the file browswer to the folder hosting the newly combined alias file for easier drag/drop or reference.
ECHO.
ECHO -Open the file browswer to the folder hosting the newly edited geojsons for easier drag/drop or reference.
ECHO.
ECHO -Close this Command Prompt window.
ECHO.
ECHO.
ECHO Note-If you don't wish for these to open, you may simply click the red X to close this window.
ECHO.
ECHO.
ECHO.
PAUSE>NUL
START "" "https://data-admin.virtualnas.net/"
START "" "https://data-admin.virtualnas.net/video-maps"
START /B /WAIT explorer.exe "!FEB_CRC_BATCH_DIR!"
START /B /WAIT explorer.exe "!CombinedALiasFilesDirectory!"
EXIT
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:FunctionsToBeCalled
:SelectDirectory
:: Resets the SELECTED_DIRECTORY variable for error checking later.
set SELECTED_DIRECTORY=NOT_DEFINED
CLS
ECHO.
ECHO.
ECHO !CmdMsgLine1!
ECHO !CmdMsgLine2!
ECHO.
ECHO.
:: Launches Windows Folder Browser window to have the user select a directory and then saves that directory to the "SELECTED_DIRECTORY" variable.
set "psCommand=(New-Object -ComObject Shell.Application).BrowseForFolder(0, '!BrowserMsg!', 0, 0).Self.Path"
for /f "usebackq delims=" %%I in (`powershell -command "%psCommand%"`) do set "SELECTED_DIRECTORY=%%I"
:: If user clicked cancel or nothing at all, it exits the Command Prompt window.
IF "!SELECTED_DIRECTORY!"=="NOT_DEFINED" EXIT
CLS
SET "BrowserMsg= "
SET "CmdMsgLine1= "
SET "CmdMsgLine2= "
GOTO :EOF
:FindFileName
:: Finds the whole file name for a given file name ending.
for /f "delims=" %%G in ('dir /b ^| findstr /L /C:"!FILE_NAME_ENDING!"') do SET file_name=%%G
GOTO :EOF
:DIRECTORY_NOT_FOUND
:: Displays an error message if the directory that is trying to be saved to a variable does not exist.
ECHO.
ECHO.
ECHO -------
ECHO ERROR
ECHO -------
ECHO.
ECHO Setting variable: !VARIABLE_NAME!
ECHO Could not find directory: !DIRECTORY_NOT_FOUND!
ECHO.
ECHO If you were running an AIRAC release, it may be a good idea to rerun FE-Buddy
ECHO prior to starting this batch file again.
ECHO.
ECHO Press any key to end this script...
PAUSE>nul
EXIT
GOTO :EOF
:DETAILS
mode con: cols=140 lines=70
CLS
ECHO.
ECHO.
ECHO What does the "The AIRAC Release Prep" do?
ECHO.
ECHO -Takes the individual Alias files from the FE-Buddy Output folder and overwrites
ECHO the appropriate corresponding files in your own "Decombined alias" file directory.
ECHO It will then combine all of the decombined alias files into one alias file in
ECHO alphanumeric order.
ECHO.
ECHO Example decombined alias files in the decombined directory:
ECHO 000_EVERYTHING ELSE.txt
ECHO 010_FAA CHART RECALL.txt
ECHO 020_NAVAID ISR.txt
ECHO 030_AIRPORT ISR.txt
ECHO 040_AIRWAY FIXES ALIAS.txt
ECHO 050_STAR DP FIXES ALIAS.txt
ECHO 060_AIRPORT_SPECIFIC_ISR.txt
ECHO 070_TELEPHONY.txt
ECHO.
ECHO Note how they have a prefixing number and ends with an underscore; This is required formatting.
ECHO The prefixing number can be as small or large as you like but the name of the file after the
ECHO underscore is REQUIRED to stay the same as it is in this example.
ECHO The names of the files can be changed if you alter the code within this script.
ECHO Another requirement for this part to work correctly is that there must be at least one blank line
ECHO at the end of each of decombined alias files.
ECHO.
ECHO.
ECHO -Takes following CRC .GeoJSON files, grabs the ones you have defined in the renaming preference .txt file,
ECHO will rename them to what you want, add the CRC defaults that you have defined, and place them into a sub-folder
ECHO labeled "vNAS BATCH UPLOAD" in the Selected FE-Buddy Output folder \CRC:
ECHO.
ECHO APT_symbols
ECHO APT_text
ECHO.
ECHO ARTCC BOUNDARIES-HIGH_lines
ECHO ARTCC BOUNDARIES-LOW_lines
ECHO.
ECHO AWY-HIGH_lines(DME Cutoff)
ECHO AWY-HIGH_lines
ECHO AWY-HIGH_symbols
ECHO AWY-HIGH_text
ECHO.
ECHO AWY-LOW_lines(DME Cutoff)
ECHO AWY-LOW_lines
ECHO AWY-LOW_symbols
ECHO AWY-LOW_text
ECHO.
ECHO FIX_symbols
ECHO FIX_text
ECHO.
ECHO NDB_symbols
ECHO NDB_text
ECHO.
ECHO RWY_lines
ECHO.
ECHO VOR_symbols
ECHO VOR_text
ECHO.
ECHO WX STATIONS_symbols
ECHO WX STATIONS_text
ECHO.
ECHO.
ECHO When the script is done, you should then be able to go to vNAS Admin site, upload the combined
ECHO alias file and then do a BATCH Upload of all the .GeoJSONs found in the vNAS BATCH Upload folder.
ECHO.
ECHO.
ECHO Press any key to return to the main menu...
PAUSE>NUL
mode con: cols=140 lines=45
GOTO HELLO
:SetFacilityID
CLS
ECHO.
ECHO.
ECHO To set the facility ID to your own:
ECHO.
ECHO 1) Close the CMD Prompt window.
ECHO.
ECHO 2) Right click on the batch file and click EDIT.
ECHO.
ECHO 3) Find the line of code near the top that says "SET FACILITY_ID=".
ECHO Note-There may be information after the equals sign.
ECHO.
ECHO 4) Replace the information after the equals sign with your own facility ID.
ECHO Ex (without quotes): "SET FACILITY_ID=ZZZ"
ECHO.
ECHO 5) Save the file and relaunch the batch file.
ECHO.
ECHO.
PAUSE
goto HELLO
:HELP
CLS
ECHO.
ECHO.
ECHO WHAT DO YOU NEED HELP WITH?
ECHO.
ECHO A) Resetting all preferences; Making it like the first time you ran this script.
ECHO -Be careful, as this will also delete your CRC GeoJSON Preferences and data.
ECHO.
ECHO B) I want to edit the CRC GeoJSON Preferences and data.
ECHO.
ECHO.
SET RESET_QUERY=NO_INPUT_BY_USER
SET /P HELP_QUERY=Type associated letter option and press Enter:
if /i "!HELP_QUERY!"=="A" GOTO HelpResetPrefs
if /i "!HELP_QUERY!"=="B" GOTO HelpEditGeoJSONprefs
goto HELP
:HelpResetPrefs
CLS
CD /D "%LocalAppdata%"
ECHO.
ECHO.
ECHO Typing "Y" without quotes will delete all previously
ECHO saved data such as directories and other preferences.
ECHO.
ECHO -Any other action will just return you to the main menu.
ECHO.
:: If user types Y (regardless of case), the !FACILITY_ID!-FE-ASSISTANT-appdata
:: folder from %LocalAppdata% and all contents will be removed which will
:: require the user to set it up again on the next run of the AIRAC Release option.
:: Typing anything else or nothing at all will return to the beginning of this scrip.
SET RESET_QUERY=NO_INPUT_BY_USER
SET /P RESET_QUERY=To reset preferences type Y, and press Enter:
if /i "!RESET_QUERY!"=="Y" (
RD /S /Q !FACILITY_ID!-FE-ASSISTANT-appdata
ECHO.
ECHO.
ECHO Your preferences has been reset.
ECHO The next time you run the AIRAC release option,
ECHO it will prompt you to setup your preferences again.
ECHO.
ECHO.
PAUSE
)
CLS
GOTO HELLO
:HelpEditGeoJSONprefs
CLS
ECHO.
ECHO.
if exist "%LocalAppData%\!FACILITY_ID!-FE-ASSISTANT-appdata\DefaultSetterPrefs" (
ECHO Press any key to open the directory with your CRC GeoJSON preference files...
PAUSE>NUL
START /B /WAIT explorer.exe "%LocalAppData%\!FACILITY_ID!-FE-ASSISTANT-appdata\DefaultSetterPrefs"
EXIT
) ELSE (
ECHO Looks like you do not yet have Default Setter Pref settings yet for !FACILITY_ID!.
ECHO.
ECHO Contact the developer if you still have issues after troubleshooting.
ECHO.
ECHO.
ECHO Press any key to return to the main menu...
PAUSE>NUL
GOTO HELLO
)
:PythonNotInstalled
:: Checks the users system to see if it is 32 or 64 bit for later use.
set "ProgramFilesPath=%ProgramFiles(x86)%"
if "%ProgramFilesPath%"=="" (
SET BIT=32
) else (
SET BIT=64
)
CLS
START "" https://www.python.org/downloads/windows/
ECHO.
ECHO.
ECHO -------
ECHO ERROR
ECHO -------
ECHO.
ECHO Python does not appear to be installed on your computer.
ECHO.
ECHO Python is required to perform certain parts of this process.
ECHO Please go to https://www.python.org/downloads/windows/ and download the latest release and install in.
ECHO -This page should have also opened in your default webbrowser.
ECHO.
ECHO It is recommended to download the "Windows installer (!BIT!-bit)"
ECHO.
ECHO.
ECHO IMPORTANT:
ECHO When you install Python, be sure "ADD PYTHON TO PATH" is checked in the installation
ECHO wizard prior to selecting "INSTALL NOW".
ECHO.
ECHO Press any key to exit...
PAUSE>NUL
exit
:Make_DefaultSetter
:: SPECIAL THANKS to Kyle Rodgers (MisterRodg) for creating this python file as a temp fix for setting Defaults into the FE-Buddy output CRC GeoJSON files!
:: Check out his GitHub here: https://github.com/misterrodg
:: Specific Default Setter repo: https://github.com/misterrodg/FEB-DefaultSetter
:: Creates the setdefaults.py file in the primary DefaultSetter directory.
(
ECHO import argparse
ECHO.
ECHO from modules.FEBDefaults import FEBDefaults
ECHO from modules.FileHandler import FileHandler
ECHO from modules.GeoJSON import GeoJSON
ECHO.
ECHO.
ECHO def processDefaults^(filePath^):
ECHO print^("\nGetting Defaults from FEB Defaults File"^)
ECHO febDefaults = FEBDefaults^(filePath^)
ECHO return febDefaults.defaults
ECHO.
ECHO.
ECHO def processFiles^(sourceDir, useSourceLocal, outputDir, useOutputLocal, defaultsArray^):
ECHO fileHandler = FileHandler^(^)
ECHO fileHandler.checkDir^(outputDir, useOutputLocal^)
ECHO fileHandler.deleteAllInSubdir^(".geojson", outputDir, useOutputLocal^)
ECHO fileList = fileHandler.searchForType^(".geojson", sourceDir, useSourceLocal^)
ECHO numFiles = str^(len^(fileList^)^)
ECHO print^(f"Found {numFiles} .geojson files in {sourceDir}"^)
ECHO fileCount = 0
ECHO for f in fileList:
ECHO fileData = fileHandler.splitFolderFile^(f, sourceDir^)
ECHO folder = fileData[0]
ECHO fileName = fileData[1].replace^(".geojson", ""^)
ECHO defaults = next^(
ECHO ^(item for item in defaultsArray if item["fileName"] == fileData[1]^), False