{echo"No config.json file exists. Please run 'pat configure' from a terminal and then CTRL-X to close the file. This will generate a blank file which this tool will assist you wil.";exit 1;}
PATSETUP=$(yad --center --wrap --title="PAT Setup and Alias Manager"\
--text="--Please ensure you have a valid winlink account and password established.\n--The raspberry pi sometimes has problems understanding 'localhost.' Use 127.0.0.1 Using 0.0.0.0 will allow you to access the PAT UI from your local network.\n--Point your browser to the local ip and port. Example: 192.168.1.15:8080"\
--image=/tmp/banner.png \
--form --separator="," --item-separator=","\
--field="Enter your callsign""$CURRENTCALL"\
--field="Enter your winlink password:H""$CURRENTPASS"\
--field="Enter your station grid square, ex. DN23""$CURRENTLOCATOR"\
--field="Select or enter your local address and port:"CBE "$CURRENTHTTP,localhost:8080,0.0.0.0:8080,127.0.0.1:8080"\
--field="Radio Model. i.e IC-7300""$CURRENTRIG"\
--field="Add/Change Rig Definition to PAT Config?:CHK""False"\
--field="Disable Rig Control for PAT?:CHK""False"\
echo"You must enter a Rig name if selecting to change the rig definition before continuing."| yad --center --text-info --wrap --title=TriMode --button="Start Over:1"${c}${r}||
{ main_menu;return;}
fi
fi
if[[$DISABLEDEF=="TRUE"]];then
if[[$CHANGEDEF=="TRUE"]];then
echo"You may select EITHER Add/Change or Remove as an option, not both."| yad \
LASTUPDATE=$(cat $HOME/Documents/ardop-list/ardoplist.txt | head -n 1)
else
getardoplist | yad --center --progress --pulsate --auto-close --auto-kill --button gtk-cancel:1 --title "Downloading ARDOP Station lists" --text "Please wait while I download the current list of ARDOP stations..."${r}${c}
--text="$LASTUPDATE\n\nSelect PAT Setup to open user and radio config.\nSelect MANAGE to view or remove current aliases.\nSelect Update to Re-Download the list of stations\nThis may take a couple minutes.\nUpdates will be visable from the PAT UI after restarting the pat http server."\
--image=/tmp/banner.png \
--button="PAT Setup:3"\
--button="MANAGE:4"\
--button="UPDATE:2"\
--button="Exit:1"\
--button="Find Stations:0"\
--form --separator="," --item-separator=","\
--field="Select desired band:CB"$BANDS\
--field="Enter Target Grid Square:CBE""$GRIDS"\
--field="Click to View Grid Square Map:BTN""$VIEWER$GRIDMAP"\
--field="Alias Format.:CB""$FORMAT"\
${c}${r})
rc=$?
if[[$rc -eq 2]];then
{ getardoplist | yad --center --progress --pulsate --auto-close --auto-kill --button gtk-cancel:1 --title "Downloading ARDOP Station lists" --text "Please wait while I download the current list of ARDOP stations..."${r}${c}; findalias_menu;return;}