Sending SMS via Mageia 6 kdeconnect

This forum is for all contributions that do not concern directly the making of the distribution.
Could be : artwork, websites development, goodies, advocacy etc.

Sending SMS via Mageia 6 kdeconnect

Postby mackowiakp » Aug 17th, '17, 11:02

Below is script, taken from (I dont remember the author - sorry) Internet and a little bit modify by me. It sends SMS from PC via Android phone.
Any suggestion how to connect it to Google or Thunderbird phone book?
Any improvements welcome!

Code: Select all
#!/bin/bash
kdeconnect-cli --refresh
urzadzenie=$(kdeconnect-cli -a --id-only 2>&1);

if [ "$urzadzenie" = "No devices found" ]; then
    kdialog --title "kconnect-cli" --msgbox "Nie wykryto urządzeń online!\nSparuj najpierw urządzenie w KDE Connect."
else

    if [ ${#urzadzenie} -gt 16 ]; then

        urzadzenie=$(kdialog --title "KDE Connect" --combobox "$(kdeconnect-cli -a) \n\nWybierz urządzenie:" $urzadzenie);
        case "$?" in
            0)
                if [ ${#urzadzenie} -eq 0 ]; then
                    kdialog --sorry "Nie wybrano żadnego urządzenia!";
                    exit 0;
                fi
            ;;

            1)
                exit 0;
            ;;
        esac;
    fi

    kto_tmp=$(kdialog --title "SMS" --inputbox "Wpisz numer telefonu:");
    ilosc=`echo -n $kto_tmp |sed 's/ //g' | wc -c`
    kto=`echo -n $kto_tmp |sed 's/ //g'`
    [ $ilosc -ne "9" ] && kdialog --error "Powinno być 9 cyfr - można używać spacji" && exit 1
    case ${kto#[-+]} in
        *[!0-9]* | '') kdialog --error "Powinno być 9 cyfr - bez liter i innych znaków"
               exit 1   ;;
        * ) ;;
        esac

    sms=$(kdialog --title "SMS" --textinputbox "Wpisz treść wiadomości do wysłania:");
        case "$?" in
            1)
                exit 0;
            ;;
        esac;

    kdialog --continue-label "Wyślij" --warningcontinuecancel "Wysłać SMS do $kto ("${tnumery[$kto]}") o treści:\n\n\"$sms\"";
        case "$?" in

            0)
                kdeconnect-cli -d $urzadzenie --destination $kto --send-sms "$sms" && notify-send -t 4000 -i kdeconnect-cli "Wysłano SMS'a!";
            ;;
            1)
                exit 0;
            ;;
        esac;
fi
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 593
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Sending SMS via Mageia 6 kdeconnect

Postby doktor5000 » Aug 17th, '17, 17:07

For thunderbird, not in a way to query the adress book directly. You could take a look at related mork parsers like https://www.jwz.org/hacks/mork.pl (see https://developer.mozilla.org/en-US/doc ... /Structure for more current information on the fileformat ) and see whether you can adapt that to parse the two adress book files abook.mab and history.mab (the first one is your actual adress book, the latter are your collected adresses). You may be better off to regularly export the adress book to .csv via e.g. the export tools mentioned in https://groups.google.com/forum/#!topic ... VF4GgfVhPc and then use that .csv from your script.

For google address book you can take a look at e.g. https://gitlab.com/goobook/goobook or https://github.com/gedl/gc-csv or https://github.com/vinitkumar/googlecl
Alternatively import all your contacts regularly into something like abook.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 16713
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany


Return to Other

Who is online

Users browsing this forum: No registered users and 1 guest