variables with number

Post your questions and help other users.

Moderator: Martin

Panda
Posts: 21
Joined: 14 Nov 2013 11:50

Re: variables with number

Post by Panda » 23 Dec 2013 19:31

Sry, muss mal auf deutsch antworten mein Englisch gibt gerade auf :D

Also ich will den flow als eine Art Anrufbeantworter benutzen, er soll die SMS nach einander Vorlesen wenn ich im Auto Musik per Bluetooth höre.
Nur trotz meiner programmier Kenntnisse ist es halt daran gescheitert, das ich die Nr vom Listen Eintrag nicht gesetzt bekommen habe. Aber mit deinem Anstoß, sollte ich jetzt hinbekommen, probiers später mal aus kann gerade nicht ;) Dann antworte ich auch wieder auf Englisch.

Panda
Posts: 21
Joined: 14 Nov 2013 11:50

Re: variables with number

Post by Panda » 23 Dec 2013 23:35

OK, so close to the end. It works like I wanted but, if I get a second message, the second list element is error

http://automagic4android.com/flow.php?i ... 8438ea3510

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: variables with number

Post by Martin » 24 Dec 2013 14:49

The condition to end the loop is probably off by one:
You are initializing the variable b with value 0 before the loop starts and increment b by one when the first message is read. The last condition of the loop uses following check:
b - 1 == length(text)

The list text contains only one element so the the script is evaluated like this:
1 - 1 == 1
which is false and makes the flow execute a second time but there's no second element in the list.

Following expression should work:
b == length(text)

Your lists with the sms text and the contact name are local so will always contain one element. You can change the names of the lists to global_text and global_name to make the lists available globally.

Automagic has a condition called Debug Dialog which greatly helps to debug a flow. The flow execution is paused when the condition is reached and a dialog with all local and global variables is shown. The Yes-button continues the flow on the true-branch of the condition and No continues the flow on the false-branch.

Post Reply