-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simple-Radio-COM.bat
2122 lines (2032 loc) · 62.4 KB
/
Simple-Radio-COM.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
set vrs=8.2
rem todo
rem Add QuickRecorder
rem Fix Stream in simple mode
Setlocal EnableDelayedExpansion
set Console=False
if not "%~1"=="" set Console=True
color 0f
if "%Console%"=="False" mode con:cols=80 lines=30
if "%Console%"=="False" cls
if "%Console%"=="False" title Simple Radio COM by W1BTR
if "%Console%"=="False" echo Loading Settings . . .
rem NOTE: Do not change these settings - change them in the settings menu after setup, or in Bin\settings.cmd.
set COMPort=NONE
set Model=
set CheckForUpdates=Y
set fromsimple=false
Set COMCheck=Nul
set Timeout=120
set RadioInput=0
set voice=0
set voice.rate=1
set voice.volume=100
set callsign=XXXXX
set Volume=100
Set MicInput=
if not exist Bin (
echo Error: Bin Folder not found.
if "%Console%"=="False" pause
exit /B
)
cd bin
cls
echo.
color 0f
echo. | set /p="[93m"
type mentions.ascii
echo.
echo.
echo [0mLoading . . .
if exist Transmit del /f /q Transmit
if exist settings.cmd call settings.cmd
REM Check for updates
if "%~1"=="-Updated" goto ranupdate
if "%CheckForUpdates%"=="N" goto :skipupdates
ping github.com -n 1 -w 2 >nul
if not %errorlevel%==0 goto skipupdates
curl https://raw.githubusercontent.com/ITCMD/SRCOM/main/LatestVersion -s -o LatestVersionDL
find "SRCOM VERSION" "LatestVersionDL" >nul 2>nul
if not "%errorlevel%"=="0" (
echo Failed to check for updates. LatestVersion file had unexpected content.
goto skipupdates
)
find "[%vrs%]" "LatestVersionDL" >nul 2>nul
if not "%errorlevel%"=="0" goto updateavailable
del /f /q LatestVersionDl
:skipupdates
set livetts.rate=%voice.rate%
timeout /t 2 /nobreak >nul
if "%callsign%"=="XXXXX" goto firsttimesetup
rem Check audio device
if "%Console%"=="False" echo Self-Checking . . .
fmedia --list-dev 2>nul | find "%AudioCheck: - Default=%" >nul 2>nul
if not %errorlevel%==0 goto audioerror
:PassAudioCheck
rem Check COM device
if "%COMPort%"=="NONE" goto passselfcheck
if "%COMPort%"=="RIGCTL" goto passselfcheck
for /f "delims=" %%A in ('wmic path win32_pnpentity get caption /format:table ^| find /i "(%COMPort%)"') do (set "COMComp=%%~A")
if not "%COMComp%"=="%COMCheck%" (
goto comerror
)
:passselfcheck
echo Self-Check Pass.
call ps1s.bat /tk "Simple Radio COM Ps1 Serial Interface"
echo Launching PTT PS1 Script
if /i not "%ComPort%"=="NONE" (
if /i not "%COMPort%"=="RIGCTL" (
start /MIN powershell -executionpolicy bypass -file "PTT Trigger.ps1" %COMPort% %Timeout%
) ELSE (
start "" "RigControl.bat"
call focuson.bat "Simple Radio COM by W1BTR" >nul
)
)
goto mainmenu
:comerror
cls
echo ERROR: COM Port Change detected.
echo.
echo COM Port is set to %COMPort%.
echo Expected Name: %COMCheck%
echo Pulled Name: %COMComp%
echo.
echo Press any key to set radio input audio output device again . . .
pause >nul
goto ComDevice
:COMDevice
echo [92mDoes your radio interface use COM to trigger PTT?[0m
echo.
choice
if %errorlevel%==2 (
set COMPort=NONE
set ComCheck=NONE
goto settings
)
echo [92mWhat COM port is your interface connected to?
echo [90mPort name is in parenthases.
echo.
echo [96mAvailable Com Ports:[0m
wmic path win32_pnpentity get caption /format:table | find "COM"
echo [90mInclude COM in entry. Example: COM5[0m
echo.
echo.
set /p COMPort=">"
echo.
wmic path win32_pnpentity get caption /format:table | find /i "(%COMPort%)" >nul 2>nul
if not "%errorlevel%"=="0" (
echo COM Port "%COMPort%" was not found.
pause
goto COMDevice
)
for /f "delims=" %%A in ('wmic path win32_pnpentity get caption /format:table ^| find /i "(%COMPort%)"') do (set COMCheck=%%~A)
echo Fantastic. We'll use COM port %COMPort% to trigger PTT.
goto settings
:firsttimesetup
cls
color 0f
type logo.ascii
echo.
echo.
echo [96mWelcome to the Simple Radio COM Setup Wizard.
echo Make sure your digirig or VOX interface is setup and plugged in.
echo Make sure you know what COM port the digirig uses, and make sure you know
echo which audio ouptut device goes to the radio's mic input.
echo Note that you can change all these settings later on.
echo.
echo [92mFirst and foremost, what's your callsign?[0m
echo This will be used in emergency broadcast mode, and if any plugins require it.
echo.
set /p callsign=">"
echo.
echo Great. Hi there, %callsign%.
:hamlibback
echo.
echo [92mNow, will you be utilizing a CAT connection to the control the radio?
echo This is separate from how the radio will trigger PTT.
echo [90mConnections are made using hamlib. See support devices here:
echo https://github.com/Hamlib/Hamlib/wiki/Supported-Radios[0m
echo.
choice
if %errorlevel%==2 goto donehamlib
echo.
echo [92mGreat, let's figure out what device you're using.
echo.
echo [96mEnter the ID number of your radio
echo [90mTo see a list of radios and their IDs, visit https://github.com/Hamlib/Hamlib/wiki/Supported-Radios[0m
echo.
set /p Model=">"
set count=0
for /f "skip=1 tokens=1 delims=" %%A in ('hamlib\bin\rigctl.exe -l ^| find /i "%Model% "') do (set /a count+=1)
if %count%==0 (
echo Model was not found. It may be named something else in hamlib's database.
echo Visit https://github.com/Hamlib/Hamlib/wiki/Supported-Radios to see a list of supported rigs.
pause
goto hamlibback
)
if %count%==1 goto hamlibselected
echo Error: Numerous matches found.
echo Please report this error at github.com/ITCMD/Simple-Radio-COM
pause
goto hamlibback
:hamlibselected
echo.
echo. | set/p="[96mSelected Device: "
rigctl -l | find /i "%Model% "
echo Continue?
choice
if %errorlevel%==2 goto hamlibback
:donehamlib
:comportback
echo.
echo [92mNow we need to know how you will trigger PTT (Push-to-talk) on your radio.[96m
echo.
echo 1] RTS Pin (Digirig or Rigblaster Pro)
echo 2] VOX (Signalink or VOX enabled rig)
if not "%model%"=="" echo 3] Use Hamlib CAT control (Recommended)
echo.
choice /c 123
if %errorlevel%==2 (
set COMPort=NONE
set ComCheck=NONE
echo.
echo Alright, no COM port, VOX it is.
goto firsttimeaudio
)
if %errorlevel%==3 (
if "%model%"=="" goto comportback
set COMPort=RIGCTL
echo.
echo Epic. We'll use hamlib to trigger PTT.
goto firsttimeaudio
)
echo [92mOkay, what COM port is your Digirig or other interface connected to?
echo [90mPort name is in parenthases.
echo.
echo [96mAvailable Com Ports:[0m
wmic path win32_pnpentity get caption /format:table | find "COM"
echo [90mInclude COM in entry. Example: COM5[0m
echo.
set /p COMPort=">"
echo.
wmic path win32_pnpentity get caption /format:table | find /i "(%COMPort%)" >nul 2>nul
if not "%errorlevel%"=="0" (
echo COM Port "%COMPort%" was not found.
pause
goto comportback
)
for /f "delims=" %%A in ('wmic path win32_pnpentity get caption /format:table ^| find /i "(%COMPort%)"') do (set COMCheck=%%~A)
echo Fantastic. We'll use COM port %COMPort% to trigger PTT.
:firsttimeaudio
echo.
echo [92mNext, what audio device is your radio's mic input connected to?[0m
echo ======================================================================
:setupa
set device=True
if exist devlist.temp del /f /q devlist.temp
for /f "skip=1 delims=" %%A in ('call fmedia --list-dev 2^>nul') do (
if "%%~A"=="Capture:" goto breaksetupa
if "!device!"=="True" (
echo [93m%%~A
set device=False
echo "%%~A">>devlist.temp
) ELSE (
echo [90m%%~A
set device=True
)
)
:breaksetupa
echo ======================================================================
echo [92mEnter Device number to act as INPUT to radio:
set /p NewRadioInput=">#"
rem strip of # in case of dumb user
set NewRadioInput=%NewRadioInput:#=%
rem check for existance of device
find "device #%NewRadioInput%: " "devlist.temp" >nul 2>nul
if not %errorlevel%==0 (
echo Device #%NewRadioInput% was not found.
pause
goto firsttimeaudio
)
for /f "skip=1 delims=" %%A in ('find "device #%NewRadioInput%: " "devlist.temp"') do (
set AudioCheck=%%~A
)
echo.
echo Use Device %AudioCheck%?
choice
if %errorlevel%==2 goto :firsttimeaudio
set RadioInput=%NewRadioInput%
echo.
echo Alright %callsign%, we'll use%AudioCheck%
echo as your radio's mic input.
:NewRadioOutput
echo.
echo [90m======================================================================
echo [92mDo you have a device you wish to record your Radio's output from?[0m
echo =======================================================================
echo [90mThis is not required, and will not automatically play your radio's audio
echo through your computer. It is only used to record conversations in the QuickRecorder.
echo.
choice
if %errorlevel%==2 goto doneinitialsetup
:setupi
set device=True
set capture=False
if exist devlist.temp del /f /q devlist.temp
for /f "skip=1 delims=" %%A in ('call fmedia --list-dev 2^>nul') do (
if "!capture!"=="True" (
if "!device!"=="True" (
echo [93m%%~A
set device=False
echo "%%~A">>devlist.temp
) ELSE (
echo [90m%%~A
set device=True
)
)
if "%%~A"=="Capture:" set capture=True
)
echo ======================================================================
echo [92mEnter Device number to act as OUTPUT from Radio:
set /p NewRadioOutput=">#"
rem strip of # in case of dumb user
set NewRadioOutput=%NewRadioOutput:#=%
rem check for existance of device
find "device #%NewRadioOutput%: " "devlist.temp" >nul 2>nul
if not %errorlevel%==0 (
echo Output Device #%NewRadioOutput% was not found.
pause
goto newradiooutput
)
for /f "skip=1 delims=" %%A in ('find "device #%NewRadioOutput%: " "devlist.temp"') do (
set OutputCheck=%%~A
)
echo.
echo Use Device %OutputCheck%?
choice
if %errorlevel%==2 goto newradiooutput
set RadioOutput=%NewRadioOutput%
:doneinitialsetup
echo.
echo [92mThat's it for the initial setup.[0m
echo.
echo But, there are more settings to explore in the settings menu, such
echo as the TTS voice, voice speed, and voice volume, or timeout settings.
echo @set "COMPort=%COMPort%">settings.cmd
echo @set "Timeout=%Timeout%">>settings.cmd
echo @set "RadioInput=%RadioInput%">>settings.cmd
echo @set "AudioCheck=%AudioCheck%">>settings.cmd
echo @set "RadioOutput=%RadioOutput%">>settings.cmd
echo @set "OutputCheck=%OutputCheck%">>settings.cmd
echo @set "MicInput=%MicInput%">>settings.cmd
echo @set "voice=%voice%">>settings.cmd
echo @set "voice.rate=%voice.rate%">>settings.cmd
echo @set "voice.volume=%voice.volume%">>settings.cmd
echo @set "callsign=%callsign%">>settings.cmd
echo @set "COMCheck=%COMCheck%">>settings.cmd
echo @set "Model=%Model%">>settings.cmd
echo.
pause
goto mainmenu
:console
if /i "%~1"=="audio" goto csaud
if /i "%~1"=="tts" goto cstts
if /i "%~1"=="schedule" goto csschedule
if /i "%~1"=="help" goto help
goto help
:help
echo Simple Radio COM by W1BTR
echo.
echo Usage: Tool is designed to be run directly, but it
echo offers some command line options for scripting.
echo.
echo Learn more at https://github.com/ITCMD/Simple-Radio-COM
echo.
echo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
echo.
echo "%~nx0" audio "file" "Output Device (optional)"
echo.
echo Allows playing of an audio file to the radio via output device.
echo.
echo "%~nx0" tts "text message" "Output Device (optional)"
echo.
echo Allows text to speech conversion and playback to the radio via output device.
echo.
echo "%~nx0" schedule "file" "Starting Time" "Output Device (optional)"
echo.
echo Allows audio files to be played at a specific time and / or date.
echo.
echo "%~nx0" help
echo.
echo Displays this help menu.
exit /b
:csschedule
if "%~2"=="" (
echo "Radio control.bat" schedule "file" "schedule" "outpt [optional]"
exit /B
)
if "%~3"=="" (
echo "Radio control.bat" schedule "file" "schedule" "outpt [optional]"
exit /B
)
set source=%~2
if not exist "%source%" (
if exist "..\%source%" (
set source=..\%source%
) ELSE (
echo "File not found: %source%"
exit /B
)
)
set Starts=%~3
powershell Get-Date '%Starts%'
if %errorlevel%==1 (
cls
echo Invalid Date/Time.
exit /b
)
if not exist "%source%" (
if exist "..\%source%" (
set source=..\%source%
) ELSE (
echo "File not found: %source%"
exit /B
)
)
if not "%~4"=="" set RadioInput=%~4
set session=%random%%random%
echo converting file
call ffmpeg -y -i "%source%" "%cd%\%session%.wav" >nul 2>nul
set file=%session%.wav
echo Preparing to transmit audio file: %file%
:csschedloop
for /f "tokens=1* delims=" %%A in ('powershell -executionpolicy bypass -File "CompareDateToNow.ps1" "%starts%"') do (
if not "%%~A"=="True" (
timeout /t 2 /nobreak >nul
goto csschedloop
)
)
echo Starting TX
set cancel=False
if exist BeforeTX.cmd call BeforeTX.cmd
if %cancel%==True goto mainmenu
if /i not "%COMPort%"=="NONE" echo. >Transmit
if /i not "%COMPort%"=="NONE" timeout /t 2 /nobreak >nul
if exist "PluginFiles\BeforeTX\*.cmd" (
for /f "tokens=1 delims=" %%a in ('dir "PluginFiles\BeforeTX\*.cmd" /b') do (
call "PluginFiles\BeforeTX\%%~a"
)
)
call "fmedia.exe" "%file:"=%" --dev=%RadioInput% 2>nul
if exist "PluginFiles\AfterTX\*.cmd" (
for /f "tokens=1 delims=" %%a in ('dir "PluginFiles\AfterTX\*.cmd" /b') do (
call "PluginFiles\AfterTX\%%~a"
)
)
echo Stopping TX
set premature=False
if not exist Transmit echo ### WARNING: Transmission was stopped before message is finished. Raise timeout.
if exist Transmit del /f /q Transmit
del /f /q %file%
timeout /t 2 /nobreak >nul
exit /b
:csaud
if "%~2"=="" (
echo "Radio control.bat" audio "file" "outpt [optional]"
exit /B
)
set source=%~2
if not exist "%source%" (
if exist "..\%source%" (
set source=..\%source%
) ELSE (
echo "File not found: %source%"
exit /B
)
)
if not "%~3"=="" set RadioInput=%~3
set session=%random%%random%
echo converting file
call ffmpeg -y -i "%source%" "%cd%\%session%.wav"
set file=%session%.wav
echo Starting TX
set cancel=False
if exist BeforeTX.cmd call BeforeTX.cmd
if %cancel%==True goto mainmenu
if /i not "%ComPort%"=="NONE" echo. >Transmit
if /i not "%ComPort%"=="NONE" timeout /t 2 /nobreak >nul
if exist "PluginFiles\BeforeTX\*.cmd" (
for /f "tokens=1 delims=" %%a in ('dir "PluginFiles\BeforeTX\*.cmd" /b') do (
call "PluginFiles\BeforeTX\%%~a"
)
)
call fmedia "%file%" --dev=%RadioInput% --volume=%Volume% --notui 2>nul
if exist "PluginFiles\AfterTX\*.cmd" (
for /f "tokens=1 delims=" %%a in ('dir "PluginFiles\AfterTX\*.cmd" /b') do (
call "PluginFiles\AfterTX\%%~a"
)
)
echo Stopping TX
set premature=False
if not exist Transmit echo ### WARNING: Transmission was stopped before message is finished. Raise timeout.
if exist Transmit del /f /q Transmit
del /f /q %file%
timeout /t 1 /nobreak >nul
exit /b
:cstts
if "%~2"=="" (
echo "Radio control.bat" tts "text" "outpt [optional]"
exit /B
)
set session=DISTRESS%random%
echo Const SAFT48kHz16BitStereo = 39 >tts%session%.vbs
echo Const SSFMCreateForWrite = 3 ' Creates file even if file exists and so destroys or overwrites the existing file >>tts%session%.vbs
echo Dim oFileStream, oVoice >>tts%session%.vbs
echo Set oFileStream = CreateObject("SAPI.SpFileStream") >>tts%session%.vbs
echo oFileStream.Format.Type = SAFT48kHz16BitStereo >>tts%session%.vbs
echo oFileStream.Open "Audio%session%.wav", SSFMCreateForWrite >>tts%session%.vbs
echo Set oVoice = CreateObject("SAPI.SpVoice") >>tts%session%.vbs
echo Set oVoice.AudioOutputStream = oFileStream >>tts%session%.vbs
echo Set oVoice.Voice = oVoice.GetVoices.Item(%voice%) >>tts%session%.vbs
echo oVoice.Rate = %voice.rate% >>tts%session%.vbs
echo oVoice.Volume = %voice.Volume% >>tts%session%.vbs
echo oVoice.Speak "%~2" >>tts%session%.vbs
echo oFileStream.Close >>tts%session%.vbs
cscript tts%session%.vbs >nul
del /f /q tts%session%.vbs
set file=Audio%session%.wav
if not "%~3"=="" set RadioInput=%~3
echo Starting TX
set cancel=False
if exist BeforeTX.cmd call BeforeTX.cmd
if %cancel%==True goto mainmenu
if /i not "%ComPort%"=="NONE" echo. >Transmit
if /i not "%ComPort%"=="NONE" timeout /t 2 /nobreak >nul
if exist "PluginFiles\BeforeTX\*.cmd" (
for /f "tokens=1 delims=" %%a in ('dir "PluginFiles\BeforeTX\*.cmd" /b') do (
call "PluginFiles\BeforeTX\%%~a"
)
)
call fmedia "%file%" --dev=%RadioInput% --volume=%Volume% --notui 2>nul
if exist "PluginFiles\AfterTX\*.cmd" (
for /f "tokens=1 delims=" %%a in ('dir "PluginFiles\AfterTX\*.cmd" /b') do (
call "PluginFiles\AfterTX\%%~a"
)
)
echo Stopping TX
del /f /q "%file%"
set premature=False
if not exist Transmit echo ### WARNING: Transmission was stopped before message is finished. Raise timeout.
if exist Transmit del /f /q Transmit
timeout /t 1 /nobreak >nul
exit /b
:mainmenu
if /i "%Console%"=="true" goto console
if not "%deletefile%"=="" del /f /q "%deletefile%"
set deletefile=
cls
color 0f
type logo.ascii
echo.
echo [%callsign%]
echo [92m1] Basic Transmit
echo [96m2] Transmit Audio File
echo [95m3] Transmit Custom TTS Message
echo [93m4] Recordings and Playback
echo [94m5] Live Text-To-Speech Mode
echo [31m6] DISTRESS MODE
echo [97mL] Open SRLogger[0m
echo [36mO] Other Station Playback[0m
echo [33mR] Open Quick Recorder[0m
echo S] Settings
echo [90mP] Plugins[0m
echo A] About
echo [90mX] Exit[0m
choice /c x123456SPRALO
if %errorlevel%==1 exit /B
set /a erl=%errorlevel%-1
if %erl%==1 goto basic
if %erl%==2 goto audio
if %erl%==3 goto custom
if %erl%==4 goto recplay
if %erl%==5 goto livetts
if %erl%==6 goto distress
if %erl%==7 goto settings
if %erl%==8 goto plugins
if %erl%==9 (
start "" "QuickRecorder.bat"
goto mainmenu
)
if %erl%==10 goto about
if %erl%==11 (
start "" "logger.bat"
goto mainmenu
)
if %erl%==12 goto recplaybacktest
exit /b %erl%
:recplaybacktest
cls
color 0f
type logo.ascii
echo.
echo [36mOther Station Playback Test[0m
echo.
echo This tool allows you to provide audio checks for other stations.
echo It will record what the radio receives untill you tell it to stop,
echo at which point it will play the audio back out your radio, allowing
echo the other station to hear themselves.
echo.
echo Note that the usefullness of this program depends on the quality of
echo your interface's audio output to the radio.
echo.
echo 1] Begin
echo X] Cancel
choice /c x1
if %errorlevel%==1 goto mainmenu
echo.
echo [92mPress any key to begin recording of radio's RX . . .[0m
pause >nul
echo [96mPress [S] to stop and save the recording.[0m
if exist templayback.mp3 del /f /q templayback.mp3
call fmedia.exe --record --dev-capture=%RadioOutput% --out tempplayback.mp3
echo [92mRecording saved.[0m
:returnafterrecord
echo 1] Play Back Recording over Radio
echo 2] Listen to Recording
echo X] Cancel
choice /c 12X
if %errorlevel%==3 goto recplaybacktest
if %errorlevel%==2 (
call fmedia.exe tempplayback.mp3 --notui
goto returnafterrecord
)
echo [96mPlaying back recording over radio . . .[0m
if /i not "%ComPort%"=="NONE" echo. >Transmit
if /i not "%ComPort%"=="NONE" timeout /t 2 /nobreak >nul
echo [102;31m[ON AIR][0m
title Simple Radio COM by W1BTR [ON AIR]
call fmedia "tempplayback.mp3" --dev=%RadioInput% --volume=%Volume% --notui
echo Ending Transmission
set premature=False
if /i not "%COMPort%"=="NONE" (
if not exist Transmit set premature=True
)
if exist Transmit del /f /q Transmit
timeout /t 1 /nobreak >nul
title Simple Radio COM by W1BTR
echo.
echo 1] Return to Selection Menu
echo X] Close
choice /c 1X
if %errorlevel%==1 echo.&echo.&goto returnafterrecord
if exist tempplayback.mp3 del /f /q tempplayback.mp3
goto mainmenu
:about
cls
echo.[93m
type mentions.ascii
echo.
echo.
echo [96mHi there, I'm Lucas Elliott, W1BTR. I'm the author of Simple-Radio-COM
echo.
echo I made this program because I wanted a program that could allow me to control
echo my radio from my computer. I wanted something simple and easy to use for simple
echo tasks.
echo Using your computer's microphone on your radio was always possible, but it
echo required numerous programs and cumbersome setup each time you wanted to just
echo make a quick contact. This program is ment to be a simple solution.
echo SRCOMM is the everything-but-digital simple radio control that I wanted.
echo.[0m
pause
goto mainmenu
:updateavailable
cls
color 0f
echo.
echo [96mThere is an update available:[0m
echo.
type LatestVersionDL
echo.
echo [96mUpdate to this version? (Press Y or N)
choice
if %errorlevel%==2 goto skipupdates
echo Preparing update . . .
curl https://raw.githubusercontent.com/ITCMD/SRCOM/main/Bin/DontRun.Updator.bat -s -o Updator.bat
updator.bat
exit
:UpdateUTC
REM get UTC times:
for /f %%a in ('wmic Path Win32_UTCTime get Year^,Month^,Day^,Hour^,Minute^,Second /Format:List ^| findstr "="') do (set %%a)
Set Second=0%Second%
Set Second=%Second:~-2%
Set Minute=0%Minute%
Set Minute=%Minute:~-2%
Set Hour=0%Hour%
Set Hour=%Hour:~-2%
Set Day=0%Day%
Set Day=%Day:~-2%
Set Month=0%Month%
Set Month=%Month:~-2%
set UTCTIME=%Hour%:%Minute%:%Second%
set UTCDATE=%Year%%Month%%Day%
exit /b
:livetts
call cmds.bat /ts "SRCOM LIVE Text-To-Speech Display" >nul
if %errorlevel%==1 (
start "" "LiveTTSTask.bat"
)
:cleartts
cls
type logo.ascii
echo.
echo.
echo [92mLive TTS Mode[0m
echo ============================================================================
echo Press the [Space] bar to start transmitting, then send as many words as you
echo want at a time, using the [Enter] key to transmit twhat you have typed in.
echo ============================================================================
echo [90mEnter "/quit" to quit amd "/?" for a list of more commands[0m
echo ============================================================================
if not exist "TTS\" md "TTS\"
set ttsnum=1
call focuson.bat "Simple Radio COM by W1BTR" >nul
:liveentry
set /p TTSEntry=">"
rem strip quotes
set "TTSEntry=%TTSEntry:"=%"
rem update UTC time
call :UpdateUTC
rem handle commands
if /i "%TTSEntry%"=="/?" goto ttscommands
if /i "%TTSEntry%"=="/quit" goto quitts
if /i "%TTSEntry%"=="/x" goto quitts
if /i "%TTSEntry%"=="/leave" goto leavetts
if /i "%TTSEntry%"=="/l" goto leavetts
if /i "%TTSEntry%"=="/c" goto cleartts
if /i "%TTSEntry%"=="/clear" goto cleartts
if /i "%TTSEntry%"=="/speed" (
echo Enter new TTS Speed [.1-10]
set /p livetts.rate=">"
echo set "livetts.rate=!livetts.rate!">"TTS\Update.cmd"
goto liveentry
)
if /i "%TTSEntry%"=="/reload" (
del /f /q "TTS\*.msg" 2>nul
call ps1s.bat /tk "Simple Radio COM Ps1 Serial Interface"
call cmds.bat /tk "SRCOM LIVE Text-To-Speech Display" >nul 2>nul
call cmds.bat /tk "SRCOM LIVE Text-To-Speech Display [ON AIR]" >nul 2>nul
goto livetts
)
if /i "%TTSEntry%"=="/r" (
del /f /q "TTS\*.msg" 2>nul
call ps1s.bat /tk "Simple Radio COM Ps1 Serial Interface"
call cmds.bat /tk "SRCOM LIVE Text-To-Speech Display" >nul 2>nul
call cmds.bat /tk "SRCOM LIVE Text-To-Speech Display [ON AIR]" >nul 2>nul
goto livetts
)
if /i "%TTSEntry%"=="/clear" (
echo set "clear=True">>"TTS\Update.cmd"
goto cleartts
)
if /i "%TTSEntry%"=="/c" (
echo set "clear=True">>"TTS\Update.cmd"
goto cleartts
)
if /i "%TTSEntry:~0,5%"=="/play" goto playfiletts
if /i "%TTSEntry%"=="/quit" goto quitts
)
if /i "%TTSEntry%"=="/q" (
start "" "QuickRecorder.bat"
goto liveentry
)
if /i "%TTSEntry%"=="/QuickRecord" (
start "" "QuickRecorder.bat"
goto liveentry
)
rem check if non-command command
if "%TTSEntry:~0,1%"=="/" (
echo Command not found.
goto liveentry
)
rem handle variables
set "TTSEntry=!TTSEntry:$CS=%CALLSIGN%!"
set "TTSEntry=!TTSEntry:$Date=%Date%!"
set "TTSEntry=!TTSEntry:$Time=%time::= %!"
set "TTSEntry=%TTSEntry:$SRC=I am using a program called SRCOMM to speak for me%"
set "TTSEntry=!TTSEntry:$CQ=CQ CQ CQ %callsign%, %callsign% calling CQ any stations over!"
set "TTSEntry=!TTSEntry:$CQDX=CQ DX CQ DX %callsign%, %callsign% calling CQ DX over!"
set "TTSEntry=!TTSEntry:$UTCT=%UTCTIME::= %!"
set "TTSEntry=!TTSEntry:$UTCD=%UTCDATE%!"
:setuplooptts
if exist "TTS\%ttsnum%.msg" (
set /a ttsnum+=1
goto setuplooptts
)
echo %TTSEntry% >"TTS\%ttsnum%.msg"
set /a ttsnum+=1
goto :liveentry
:playfiletts
if not exist "%TTSEntry:~6%" (
echo [91mCould not find file: "%TTSEntry:~6%"[0m
goto liveentry
)
echo set "AudioFile=%TTSEntry:~6%">>"TTS\Update.cmd"
echo [96mOK[0m
goto liveentry
:quitts
call cmds.bat /tk "SRCOM LIVE Text-To-Speech Display" >nul 2>nul
call cmds.bat /tk "SRCOM LIVE Text-To-Speech Display [ON AIR]" >nul 2>nul
if exist Transmit del /f /q Transmit
if exist TTS\*.msg del /f /q TTS\*.msg
if exist TTS\*.cmd del /f /q TTS\*.cmd
goto mainmenu
:leavetts
echo set "Leave=True">>"TTS\Update.cmd"
goto mainmenu
:ttscommands
cls
echo [96mLive TTS Commands list:[0m
echo.
echo /? [/?] - Show this page
echo /quit [/x] - End all transmissions and exit
echo /leave [/l] - Exit but finish transmissions
echo /reload [/r] - Cancel transmissions and reload the display
echo /clear [/c] - Clear SRCOM and Display Window
echo.
echo /play [File] [/p] - Play audio File
echo /QuickRecord [/q] - Launch Quick-recorder
echo.
echo [96mVariables are:[0m
echo $CS - Your callsign (%CALLSIGN%)
echo $Date - Current date (%date%)
echo $Time - Current local time (%time%)
echo $UTCT - Current UTC time (%UTCTIME%)
echo $UTCD - Current UTC date (%UTCDATE%)
echo $SRC - (I am using a program called SRCOMM to speak for me)
echo $CQ - (CQ CQ CQ %callsign% %callsign% calling CQ any stations over)
echo $CQDX - (CQ DX CQ DX %callsign% %callsign% calling CQ DX over)
echo.
pause
goto cleartts
:recplay
cls
type logo.ascii
echo.
echo [92mRecord and Playback Messages[0m
echo Press any number to transmit recording.
echo ============================================================================
if not exist PlaybackRecordings md PlayBackRecordings
set rec=0
:recloop
if exist "PlaybackRecordings\%rec%.wav" (
set /p temprecname=<"PlaybackRecordings\%rec%.ini"
echo %rec%] !temprecname!
) ELSE (
echo [90m%rec%] Not Set. Press R to open record menu.[0m
)
if %rec%==9 goto endrecloop
set /a rec+=1
goto recloop
:endrecloop
echo ============================================================================
echo [90mNote: Plugins do not apply to recordings.
echo [92m[R] - Record [L] - Listen [D] - Delete [X] - Exit[0m
echo ============================================================================
choice /c 1234567890rldx /N >nul
if %errorlevel% LSS 10 (
set play=%errorlevel%
goto playrec
)
if %errorlevel%==10 (
set play=0
goto playrec
)
if %errorlevel%==11 goto recnew
if %errorlevel%==12 goto reclisten
if %errorlevel%==13 goto recdelete
if %errorlevel%==14 (
if "%fromsimple%"=="true" goto :basic
if "%fromlivetts%"=="true" goto :livetts
goto mainmenu
)
:playrec
if not exist "PlaybackRecordings\%play%.wav" (
set recnum=%play%
goto startrecnew
)
cls
type logo.ascii
echo.
echo.
echo Transmitting Recording . . .
echo.
color e0
if /i not "%ComPort%"=="NONE" echo. >Transmit
if /i not "%ComPort%"=="NONE" timeout /t 2 /nobreak >nul
echo [102;31m[ON AIR][0m
title Simple Radio COM by W1BTR [ON AIR]
call fmedia "PlaybackRecordings\%play%.wav" --dev=%RadioInput% --volume=%Volume%
echo Ending Transmission
set premature=False
if /i not "%COMPort%"=="NONE" (
if not exist Transmit set premature=True
)
if exist Transmit del /f /q Transmit
color e0
timeout /t 1 /nobreak >nul
color 0f
title Simple Radio COM by W1BTR
if "%premature%"=="True" (
echo WARNING: Transmission ended before end of file.
echo Make sure you accomodate for any start and stop tones in the timeout.
echo.
pause
)
goto recplay
:recdelete
echo.
echo Enter Recording Number to delete
echo [90mEnter X to cancel[0m
set /p recnum=">"
if "%recnum%"=="0" goto startrecdel
if "%recnum%"=="1" goto startrecdel
if "%recnum%"=="2" goto startrecdel
if "%recnum%"=="3" goto startrecdel
if "%recnum%"=="4" goto startrecdel
if "%recnum%"=="5" goto startrecdel
if "%recnum%"=="6" goto startrecdel
if "%recnum%"=="7" goto startrecdel
if "%recnum%"=="8" goto startrecdel
if "%recnum%"=="9" goto startrecdel
goto recplay
:startrecdel
cls
echo [91mDeleteRecording #%recnum%
set /p temprecname=<"PlaybackRecordings\%recnum%.ini"
echo [93m%temprecname%[91m
echo.
echo Are you sure?[0m
choice
if %errorlevel%==2 goto recplay
del /f /q "PlaybackRecordings\%recnum%.wav"
del /f /q "PlaybackRecordings\%recnum%.ini"
goto recplay
:reclisten
echo.
echo Enter Recording Number to Listen to
echo [90mEnter X to cancel[0m
set /p recnum=">"
if "%recnum%"=="0" goto startrecplay
if "%recnum%"=="1" goto startrecplay
if "%recnum%"=="2" goto startrecplay
if "%recnum%"=="3" goto startrecplay
if "%recnum%"=="4" goto startrecplay
if "%recnum%"=="5" goto startrecplay
if "%recnum%"=="6" goto startrecplay
if "%recnum%"=="7" goto startrecplay
if "%recnum%"=="8" goto startrecplay
if "%recnum%"=="9" goto startrecplay
goto recplay
:startrecplay
cls
echo [92mPlaying Recording #%recnum% . . .
set /p temprecname=<"PlaybackRecordings\%recnum%.ini"
echo [90m%temprecname%[93m
echo.
fmedia "PlaybackRecordings\%recnum%.wav" >nul
echo.[0m
pause
goto recplay
:recnew
echo.
echo Enter Recording Number to Overwrite
echo [90mEnter X to cancel[0m
set /p recnum=">"
if "%recnum%"=="0" goto startrecnew
if "%recnum%"=="1" goto startrecnew
if "%recnum%"=="2" goto startrecnew
if "%recnum%"=="3" goto startrecnew
if "%recnum%"=="4" goto startrecnew
if "%recnum%"=="5" goto startrecnew
if "%recnum%"=="6" goto startrecnew
if "%recnum%"=="7" goto startrecnew
if "%recnum%"=="8" goto startrecnew
if "%recnum%"=="9" goto startrecnew
goto recplay
:startrecnew
cls
echo [92mNew Recording[0m
echo.