Send sms command

157 views
Skip to first unread message

Morgan Young

unread,
Jul 12, 2021, 12:36:55 AMJul 12
to Tasker
Send sms command is sending each sms twice.  On samsung s20.

Morgan Young, BS, EMT-P, DM, I/C
Paramedic
417.501.6285
ryo...@mo1dmat.com
richard.m....@gmail.com

João Dias

unread,
Jul 12, 2021, 6:03:09 AMJul 12
to tas...@googlegroups.com
Hi. So if you create a new task, add a send SMS action to send an SMS to yourself with some text and then run it, you'll receive 2 SMS?

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


Morgan Young

unread,
Jul 13, 2021, 6:50:49 PMJul 13
to Tasker
I did that task and it worked out ok.

this task does not workout so well.

    Send a holiday greeting (129)
    Stay Awake
    A1: Variable Set [ Name:%message To:Happy New Year!   Max Rounding Digits:3 ] If [ %DATE ~ 1-1-** ]
    A2: Variable Set [ Name:%message To:Merry Christmas! 🎄🎁  Max Rounding Digits:3 ] If [ %DATE ~ 12-25-** ]
    A3: Variable Set [ Name:%message To:Happy Independance Day!  💥💣💥💣 Max Rounding Digits:3 ] If [ %DATE ~ 7-4-** ]
    A4: Variable Set [ Name:%message To:Happy Thanksgiving! Max Rounding Digits:3 ] If [ %DATE ~ 11-**-** & %DAYW ~ Thursday ]
    A5: Read File [ File:contacts_mobile_nums.txt To Var:%Contacts_mobile_nums ] 
    A6: Variable Split [ Name:%Contacts_mobile_nums Splitter:; Delete Base:On ] 
    A7: Array Process [ Variable Array:%Contacts_mobile_nums Type:Remove Duplicates ] 
    A8: Variable Set [ Name:%SentSMS To:0 Max Rounding Digits:3 ] If [ %SentSMS !Set ]
    A9: Array Process [ Variable Array:%Contacts_mobile_nums Type:Squash ] 
    A10: For [ Variable:%contact Items:%Contacts_mobile_nums(1:600) ] 
    A11: Stop [  ] If [ %contact ~ --------* ]
    A12: Flash [ Text:%contact Long:On ] 
    A13: Notify [ Title:%contact Text:%message Number:0 Priority:5 LED Colour:Red LED Rate:1 Category:super_tasker_notifications_created_by_me_the_developer Actions:(1) ] 
    A14: AutoNotification [ Configuration:Title: %contact
    Text: Have sent %SentSMS messages
    Icon: android.resource://net.dinglisch.android.taskerm/hl_aaa_ext_anchor
    Status Bar Text Size: 16
    Id: Holiday
    Timeout: 90000
    Priority: 0
    Visibility: Public
    Number: 1
    Use Chronometer: true
    LED Color: blue
    Text Expanded: Sent %contact a message.  That is %SentSMS sent messages
    Category Id: autonotificaton_super_tasker_notifications
    Separator: ,
    Only on Phone: true Timeout (Seconds):20 ] 
    A15: Send SMS [ Number:%contact Message:%message Store In Messaging App:On SIM Card:AT&T Continue Task After Error:On ] If [ %contact neq ------------------------
    
    -------------------* ]
    A16: Variable Add [ Name:%SentSMS Value:1 Wrap Around:0 ] 
    A17: Flash [ Text:Sent %contact a message.  That is %SentSMS sent messages Long:On ] 
    A18: Wait [ MS:0 Seconds:15 Minutes:0 Hours:0 Days:0 ] 
    A19: End For 
    A20: Array Clear [ Variable Array:%Contacts_mobile_nums ]



Morgan Young, BS, EMT-P, DM, I/C
Paramedic
417.501.6285
ryo...@mo1dmat.com
richard.m....@gmail.com
--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/CAG6Z%2BFfpyT%2BSU_Soa2BkfrgP2_mBQta-mHqhx6oSGzh80hxPpg%40mail.gmail.com.

João Dias

unread,
Jul 14, 2021, 4:54:11 AMJul 14
to tas...@googlegroups.com
Maybe  %Contacts_mobile_nums   contains duplicate numbers?

Morgan Young

unread,
Jul 18, 2021, 11:56:25 AMJul 18
to Tasker
I have the "delete duplicates" action in the array, but some address book enties might have country code in the entry, others without it.

is there anyway to get the java to look at just the google address book?   there seems to be multiple address books on my phone, one from each app that uses the address book.

Thank you.


Morgan Young, BS, EMT-P, DM, I/C
Paramedic
417.501.6285
ryo...@mo1dmat.com
richard.m....@gmail.com
--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.

Morgan Young

unread,
Sep 25, 2021, 12:23:35 PMSep 25
to Tasker
this issue has not gotten better.   I have 4 tasks that send SMS.  if they involve a variable array and a for command, they send doubles to each.

jmjc...@gmail.com

unread,
Sep 26, 2021, 8:05:35 AMSep 26
to Tasker
Well, if it is the same "duplicate" numbers issue, you will have to fix that first. How did you prepare the  contacts_mobile_nums.txt file? Pls show us the task description that created that file.

Morgan Young

unread,
Sep 26, 2021, 1:00:22 PMSep 26
to Tasker
To clarify, this happen with any send sms command that uses any variable and for comman.


To answer your question:
    Task: Get Mobile Contacts
    Stay Awake
    
    A1: Delete File [
         File: contacts_mobile_nums.txt
         Shred Level: 0 Continue Task After Error:On ]
    
    A2: Delete File [
         File: contacts_mobile_names.txt
         Shred Level: 0 Continue Task After Error:On ]
    
    A3: Array Clear [
         Variable Array: %Contacts_mobile_nums ]
    
    A4: Array Clear [
         Variable Array: %Contacts_mobile_nums ]
    
    A5: Java Function [
         Return: cr
         Class Or Object: CONTEXT
         Function: getContentResolver
         {ContentResolver} ()
         Param: 
         Param: 
         Param: 
         Param: 
         Param: 
         Param: 
         Param:  ]
    
    A6: Java Function [
         Return: uri
         Class Or Object: Uri
         Function: parse
         {Uri} (String)
         Param: content://com.android.contacts/data/phones
         Param: 
         Param: 
         Param: 
         Param: 
         Param: 
         Param:  ]
    
    A7: Java Function [
         Return: cur
         Class Or Object: cr
         Function: query
         {Cursor} (Uri, String[], String, String[], String)
         Param: uri
         Param: 
         Param: 
         Param: 
         Param: upper(display_name) ASC
         Param: 
         Param:  ]
    
    A8: Java Function [
         Return: 
         Class Or Object: cur
         Function: moveToFirst
         {boolean} ()
         Param: 200
         Param: 
         Param: 
         Param: 
         Param: 
         Param: 
         Param:  ]
    
    <Start loop>
    A9: Anchor
    
    A10: Java Function [
          Return: type
          Class Or Object: cur
          Function: getColumnIndex
         {int} (String)
          Param: data2
          Param: 
          Param: 
          Param: 
          Param: 
          Param: 
          Param:  ]
    
    A11: Java Function [
          Return: %type
          Class Or Object: cur
          Function: getString
         {String} (int)
          Param: type
          Param: 
          Param: 
          Param: 
          Param: 
          Param: 
          Param:  ]
    
    A12: If [ %type ~ 2 ]
    
        A13: Java Function [
              Return: dispname
              Class Or Object: cur
              Function: getColumnIndex
             {int} (String)
              Param: display_name
              Param: 
              Param: 
              Param: 
              Param: 
              Param: 
              Param:  ]
    
        A14: Java Function [
              Return: %name
              Class Or Object: cur
              Function: getString
             {String} (int)
              Param: dispname
              Param: 
              Param: 
              Param: 
              Param: 
              Param: 
              Param:  ]
    
        A15: Java Function [
              Return: phone
              Class Or Object: cur
              Function: getColumnIndex
             {int} (String)
              Param: data1
              Param: 
              Param: 
              Param: 
              Param: 
              Param: 
              Param:  ]
    
        A16: Java Function [
              Return: %phone
              Class Or Object: cur
              Function: getString
             {String} (int)
              Param: phone
              Param: 
              Param: 
              Param: 
              Param: 
              Param: 
              Param:  ]
    
        A17: Write File [
              File: contacts_mobile_nums.txt
              Text: %phone;
              Append: On
              Add Newline: On ]
    
        A18: Write File [
              File: contacts_mobile_names.txt
              Text: %name;
              Append: On
              Add Newline: On ]
    
        A19: Array Push [
              Variable Array: %contact_mobile_nums
              Position: 1
              Value: %phone ]
    
        A20: Array Push [
              Variable Array: %contact_mobile_names
              Position: 1
              Value: %phone ]
    
    A21: End If
    
    A22: Java Function [
          Return: %last
          Class Or Object: cur
          Function: isLast
         {boolean} ()
          Param: 
          Param: 
          Param: 
          Param: 
          Param: 
          Param: 
          Param:  ]
    
    A23: Java Function [
          Return: 
          Class Or Object: cur
          Function: moveToNext
         {boolean} ()
          Param: 
          Param: 
          Param: 
          Param: 
          Param: 
          Param: 
          Param:  ]If  [ %last ~ false ]
    
    A24: Goto [
          Type: Action Label
          Label: Start loop ]If  [ %last ~ false ]
    
    A25: Write File [
          File: contacts_mobile_nums.txt
          Text: ------------------------
         
         
         
         --------------------------
          Append: On
          Add Newline: On ]
    
    A26: Write File [
          File: contacts_mobile_names.txt
          Text: %name;
          Append: On
          Add Newline: On ]
    
    A27: Flash [
          Text: %contact_mobile_names()
          Long: On ]
    
    A28: Flash [
          Text: %contact_mobile_nums()
          Long: On ]
    
    A29: Notify [
          Title: Mobilephone numbers
          Text: %contact_mobile_nums()
          Icon: mw_communication_contact_phone
          Number: 0
          Priority: 3
          LED Rate: 0 ]
    
    A30: Notify [
          Title: Mobilephone names
          Text: %contact_mobile_names()
          Icon: mw_communication_contact_phone
          Number: 0
          Priority: 3
          LED Rate: 0 ]
    
    A31: Perform Task [
          Name: Send a holiday greeting
          Priority: %priority-1 ]
    
    



And then the task "send a holiday greeting":

    Task: Send a holiday greeting
    A8: Array Process [
         Variable Array: %Contacts_mobile_nums
         Type: Remove Duplicates ]
    
    A9: Array Process [
         Variable Array: %Contacts_mobile_nums
         Type: Squash ]
    
    A10: Variable Set [
          Name: %SentSMS
          To: 0
          Max Rounding Digits: 3 ]If  [ %SentSMS !Set ]
    
    A11: For [
          Variable: %contact
          Items: %Contacts_mobile_nums(1:600) ]
    
        A12: Stop [ ]If  [ %contact ~ --------* ]
    
        A13: Flash [
              Text: %contact
              Long: On ]
    
        A14: Notify [
              Title: %contact
              Text: %message
              Number: 0
              Priority: 5
              LED Colour: Red
              LED Rate: 1
              Category: super_tasker_notifications_created_by_me_the_developer Actions:(1) ]
    
        A15: AutoNotification [
              Configuration: Title: %contact
             Text: Have sent %SentSMS messages
             Icon: android.resource://net.dinglisch.android.taskerm/hl_aaa_ext_anchor
             Status Bar Text Size: 16
             Id: Holiday
             Timeout: 90000
             Priority: 0
             Visibility: Public
             Number: 1
             Use Chronometer: true
             LED Color: blue
             Text Expanded: Sent %contact a message.  That is %SentSMS sent messages
             Category Id: autonotificaton_super_tasker_notifications
             Separator: ,
             Only on Phone: true
              Timeout (Seconds): 20 ]
    
        A16: [X] Send SMS [
              Number: %contact
              Message: %message
              Store In Messaging App: On
              SIM Card: AT&T Continue Task After Error:On ]If  [ %contact neq ------------------------
    
    -------------------* ]
    
        A17: Variable Add [
              Name: %SentSMS
              Value: 1
              Wrap Around: 0 ]
    
        A18: Flash [
              Text: Sent %contact a message.  That is %SentSMS sent messages
              Long: On ]
    
        A19: Wait [
              MS: 0
              Seconds: 15
              Minutes: 0
              Hours: 0
              Days: 0 ]
    
    A20: End For
    
    A21: Array Clear [
          Variable Array: %Contacts_mobile_nums ]
    
    A22: Flash [
          Text: Sent %SentSMS text messages ]
    
    A23: AutoNotification [
          Configuration: Title: Sent SMS
         Text: Sent %SentSMS text messages
         Status Bar Text Size: 16
         Separator: ,
          Timeout (Seconds): 20
          Structure Output (JSON, etc): On ]
    
    

Morgan.

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.

jmjc...@gmail.com

unread,
Sep 27, 2021, 3:45:13 AMSep 27
to Tasker
The two tasks look fine. 

The problem remains the same. If you have duplicate phone numbers in the file, e.g. same phone number but one with country code and one without, you have to somehow fix that first. Otherwise the Array Rempve Duplicates won't remove anything because the two are technically not the same, and not duplicates. 

You either add your country code to all of the phone numbers or you remove country code from all of them. Then you can use Array Remove Duplicates and everything will work. You can do it manually one by one on your phone but if you have a lot of contacts, it will take a long time. If phone numbers in your country are in a certain format, then you can use Tasker to fill in the country code if a phone number doesn't have one.

For example, in the U.S., 3101234567 and 13101234567 are the same number, one with country code and one without. You can use Tasker to check if a number is 10-digit long, if it is, append 1 (the country code) to it. Now both numbers are 13101234567. And if you now use Array Remove Duplicates, one of them will be removed and your Send SMS will work properly.

Morgan Young

unread,
Sep 30, 2021, 2:56:31 PMSep 30
to Tasker
what made me question this is it also sends duplicates when other tasks are run.   like this one:

    Task: SMS the PRN Medics
    
    A1: [X] Variable Query [
         Title: What day?
         Variable: %needoff
         Input Type: Normal Text
         Layout: Variable Query
         Timeout (Seconds): 40
         Show Over Keyguard: On ]
    
    A2: Variable Set [
         Name: %message
         To: Would you be willing to work on August 27?   
         Max Rounding Digits: 3 ]
    
    A3: Variable Set [
         Name: %PRNs
         To: 4175016285
         Max Rounding Digits: 3 ]
    
    A4: Variable Split [
         Name: %PRNs
         Splitter: , ]
    
    A5: Array Process [
         Variable Array: %PRNs
         Type: Remove Duplicates ]
    
    A6: Variable Set [
         Name: %SentSMS
         To: 0
         Max Rounding Digits: 3
         Structure Output (JSON, etc): On ]
    
    A7: Array Process [
         Variable Array: %PRNs
         Type: Squash ]
    
    A8: For [
         Variable: %contact
         Items: %PRNs(1:6) ]
    
        A9: Flash [
             Text: %contact
             Long: On ]
    
        A10: Notify [
              Title: %contact
              Text: %message
              Number: 0
              Priority: 3
              LED Colour: Red
              LED Rate: 0
              Category: 1 ]
    
        A11: AutoNotification [
              Configuration: Title: %contact
             Text: Messaged them at %contact
             Icon: /storage/emulated/0/AutoNotification/iconfinder_star_of_life_3408698.svg
             Status Bar Text Size: 16
             Id: Holiday
             Timeout: 90000
             Priority: 0
             Visibility: Public
             Number: 1
             Use Chronometer: true
             LED Color: red
             Text Expanded: %message
             Category Id: autonotificaton_super_tasker_notifications
             Separator: ,
             Only on Phone: true
              Timeout (Seconds): 20 ]
    
        A12: Variable Add [
              Name: %SentSMS
              Value: 1
              Wrap Around: 0 ]
    
        A13: Send SMS [
              Number: %contact
              Message: %message
              Store In Messaging App: On
              SIM Card: Google Fi Continue Task After Error:On ]
    
        A14: Wait [
              MS: 0
              Seconds: 5
              Minutes: 0
              Hours: 0
              Days: 0 ]
    
    A15: End For
    
    A16: Flash [
          Text: Sent %SentSMS text messages ]
    
    

Morgan,

jmjc...@gmail.com

unread,
Oct 1, 2021, 1:28:50 AMOct 1
to Tasker
The task above is logically incorrect. There is only ONE number to send but your for loop is running 6 times. When you run the above task, how many messages did get send?

Morgan Young

unread,
Oct 2, 2021, 10:14:58 PMOct 2
to Tasker
I removed the 6 numbers and only put mine for their privacy reasons.

jmjc...@gmail.com

unread,
Oct 2, 2021, 11:29:06 PMOct 2
to Tasker
So, when you run the above task, with only one number, it still sends duplicate messages to that one number?

Morgan Young

unread,
Oct 2, 2021, 11:35:26 PMOct 2
to Tasker

jmjc...@gmail.com

unread,
Oct 3, 2021, 10:13:03 PMOct 3
to Tasker
Did you run it with %PRNs(1:6) in A8?

Morgan Young

unread,
Oct 4, 2021, 9:15:00 AMOct 4
to Tasker
this task ran this morning and sent two sms:

    Task: Birthday checks
    
    A1: Perform Task [
         Name: Never txt
         Priority: %priority+3 ]
    
    A2: AutoContacts Query 2.0 [
         Configuration: Sort: event_next_date
         Sort Direction: Ascending
         Fields to Get: Id,Event Type Label,Name,Event Next Date
         Joiner: =:=
         Timeout (Seconds): 60 ]
    
    A3: Flash [
         Text: %acevent_next_date %acevent_type_label ]
    
    A4: Flash [
         Text: %acid %acname ]
    
    A5: For [
         Variable: %index
         Items: 1:%acevent_next_date(#) ]
    
        A6: AutoTools Time [
             Configuration: 
             ---------Start Date---------
             ---------End Date---------
             Use Now: true
             Timeout (Seconds): 630 ]
    
        A7: Flash [
             Text: %atdatestotalhours ]
    
        A8: If [ %atdatestotalhours > 0 ]
    
            A9: Variable Set [
                 Name: %name
                 To: %acname(%index)
                 Max Rounding Digits: 0 ]
    
            A10: Variable Split [
                  Name: %name ]
    
            A11: Variable Set [
                  Name: %event
                  To: %acevent_type_label(%index)
                  Max Rounding Digits: 0 ]
    
            A12: Variable Set [
                  Name: %contactid
                  To: %acid(%index)
                  Max Rounding Digits: 0 ]
    
            A13: AutoContacts Query 2.0 [
                  Configuration: Ids: %contactid
                 Default Phone Number: true
                 Sort Direction: Ascending
                 Fields to Get: Whatsapp Uri,Nickname,Id,Phone Number,Hangouts Uri,Name
                 Joiner: =:=
                  Timeout (Seconds): 1210 Continue Task After Error:On ]
    
            A14: Flash [
                  Text: %name1 has a %event today! Contact at %acnumber. ]
    
            A15: AutoNotification [
                  Configuration: Title: %event today
                 Text: %name1 has a %event today! Contact at %acnumber.
                 Status Bar Text Size: 16
                 Id: %name1 %event
                 Share: true
                 Action Icon 1 Manual: android.resource://net.dinglisch.android.taskerm/hd_device_access_end_call
                  Timeout (Seconds): 986 ]
    
            A16: Send SMS [
                  Number: %acnumber
                  Message: Happy %event %name1!
                  Store In Messaging App: On ]
                If  [ %acnumber !~ %Nevertxt(#) ]
    
        A17: Else
    
            A18: AutoNotification [
                  Configuration: Title: 🎂 Birthdays today
                 Text: No birthdays 🎂 found for today.
                 Status Bar Text Size: 16
                 Id: %name1 %event
                 Share: true
                 Action Icon 1 Manual: android.resource://net.dinglisch.android.taskerm/hd_device_access_end_call
                  Timeout (Seconds): 986 ]
                If  [ %acnumber !Set ]
    
            A19: Stop [ ]
    
        A20: End If
    
    A21: End For
    
    A22: Perform Task [
          Name: Get Mobile Contacts
          Priority: %priority-1 ]
    
    

Morgan.

Morgan Young

unread,
Oct 4, 2021, 9:21:20 AMOct 4
to Tasker
I reran this task again with two phone numbers and had A8 set as PRNs(1:2)
And it still sent 2 text messages to each number for a total of 4.

Morgan

On Sun, Oct 3, 2021, 21:13 jmjc...@gmail.com <jmjc...@gmail.com> wrote:

jmjc...@gmail.com

unread,
Oct 5, 2021, 3:53:30 AMOct 5
to Tasker
What if you create a new task, with a single Send SMS action, using one of the numbers you used above. Does it still get sent twice to the same number?

Morgan Young

unread,
Oct 5, 2021, 8:05:05 AMOct 5
to Tasker
yes.   I did that first back when joao asked me.

Morgan Young

unread,
Oct 5, 2021, 8:07:39 AMOct 5
to Tasker
it seems to be happening whenever a variable is involved.

jmjc...@gmail.com

unread,
Oct 5, 2021, 10:52:00 AMOct 5
to Tasker
So, if you put a phone number directly in the Number field of the Send SMS action, it only sends once?

If so, how about you set the number in a variable, e.g. %phone = 4171234567, and then put %phone in the Number field of the Send SMS action. See if that works.

jmjc...@gmail.com

unread,
Oct 5, 2021, 10:58:19 AMOct 5
to Tasker
My guess is if you set your variable incorrectly, it will send twice. For example, if the variable has "4171234567,4171234567", it will send twice.

Morgan Young

unread,
Oct 5, 2021, 3:29:55 PMOct 5
to Tasker
I just did this task and got the messages like in the picture:       


Task: Send me a text
    
    A1: Send SMS [
         Number: 417********
         Message: Hey, how many did you get? ]
    
    

Morgan 

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Screenshot_20211005-115807_Messages.jpg
Reply all
Reply to author
Forward
0 new messages