1
0
mirror of https://github.com/km4ack/patmenu2.git synced 2025-05-16 14:50:13 -07:00

add multiple file check

This commit is contained in:
KM4ACK 2022-08-02 07:32:55 -05:00
parent 9855837af4
commit fd21e0834c

View File

@ -12,18 +12,7 @@ PATCALL=$(grep mycall $HOME/.config/pat/config.json | head -1 | sed 's/"mycall":
LIST=$HOME/.local/share/pat/mailbox/$PATCALL/in LIST=$HOME/.local/share/pat/mailbox/$PATCALL/in
MAILBOX=$HOME/.local/share/pat/mailbox/$PATCALL/in MAILBOX=$HOME/.local/share/pat/mailbox/$PATCALL/in
#Warn user about multiple WL2K_NEARBY Reports in inbox
yad --form --width=500 --text-align=center --center --title="WL2K to ARPS Object" --text-align=center \
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
--text="<b>CAUTION</b>\rBe sure only one WL2K_NEARBY report\ris in your inbox. Multiples will cause erroneous data."
BUT=$?
if [ $BUT = 1 ]; then
$MAIN &
exit
elif [ $BUT = 252 ]; then
exit
fi
#remove exiting file if it exist #remove exiting file if it exist
if [ -f $HOME/Desktop/gateways.pos ]; then if [ -f $HOME/Desktop/gateways.pos ]; then
@ -35,10 +24,22 @@ yad --center --timeout=2 --timeout-indicator=top --no-buttons \
--text="<b>Processing File</b>" & --text="<b>Processing File</b>" &
#Look for the WL2K_NEARBY email #Look for the WL2K_NEARBY email
COUNT=0
#var=$((var+1))
for file in $MAILBOX/* for file in $MAILBOX/*
do do
NEARBY_LIST=$(grep WL2K_NEARBY $file) NEARBY_LIST=$(grep WL2K_NEARBY $file)
if [ -n "$NEARBY_LIST" ]; then if [ -n "$NEARBY_LIST" ]; then
COUNT=$((COUNT+1))
if [ $COUNT -gt 1 ]; then
#Warn user about multiple WL2K_NEARBY Reports in inbox
yad --form --width=500 --text-align=center --center --title="WL2K to ARPS Object" --text-align=center \
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
--text="<b>Multiples Found</b>\rBe sure only one WL2K_NEARBY report\ris in your inbox. Multiples will cause erroneous data." \
--button=gtk-ok
$MAIN &
exit
fi
FILE=$file FILE=$file
fi fi
done done
@ -81,7 +82,8 @@ done < /run/user/$UID/tempgatelist
#let user know processing is finished #let user know processing is finished
yad --form --width=500 --text-align=center --center --title="WL2K to ARPS Object" --text-align=center \ yad --form --width=500 --text-align=center --center --title="WL2K to ARPS Object" --text-align=center \
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \ --image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
--text="<b>Processing done.</b>\rA gateways.pos file has been created and\r is on your desktop ready to import into YAAC." --text="<b>Processing done.</b>\rA gateways.pos file has been created and\r is on your desktop ready to import into YAAC." \
--button=gtk-ok
#remove the temp file #remove the temp file
rm /run/user/$UID/tempgatelist rm /run/user/$UID/tempgatelist