Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Jaqueline

unread,
Feb 19, 2018, 3:37:56 AM2/19/18
to mitappinv...@googlegroups.com
Hello,
I want to convert a phone number to morse code.  We have a +country code with number, how to get rid of that + and do the conversion.  If I use a textbox instead of phone number it works but I exchange the textbox.text with global alertPhoneNumber which is the phone number of the sender it stops working.  Maybe I have some errors and I guess also the + is a big error.
I attached some blocks.
Thank you in advance
11.PNG
12.PNG
13.PNG
14.PNG

TimAI2

unread,
Feb 19, 2018, 5:12:06 AM2/19/18
to MIT App Inventor Forum
Use lookup in pairs




Jaqueline

unread,
Feb 19, 2018, 6:41:15 AM2/19/18
to mitappinv...@googlegroups.com
This working well.  But when I changed from TextBox1.text to the number from which I received the message, it shows not found.
I am going to attach what I did.
And I have some numbers already saved in a list to match there contact name so this should work like when I receive the message From: name => shows morse code of name not phone number.  In case, the sender's number doesn't exist so of course I will get message From: +2153543473568 => I will get the morse code of that number.
The phone number to contact name conversion is working well.  Just I have a problem with the conversion.

Maybe I can get what I received in the label and filter everything after From: and before the message and dothe conversion?

Thank you in advance,

messagesms (1).aia

Pawan

unread,
Feb 19, 2018, 7:11:13 AM2/19/18
to MIT App Inventor Forum
I think maybe in your case it will be better to take what is in label and filter the part of the phone number or contact name then do the conversion.  The conversion will depend on if you got a phone number as it because it wasn't in your list of numbers or you have a contact name

Jaqueline

unread,
Feb 19, 2018, 7:12:47 AM2/19/18
to MIT App Inventor Forum
I am new to app inventor, I tried to do that but it didn't work for me, maybe I did some mistakes in my blocks.
I need help

Ghica

unread,
Feb 19, 2018, 7:36:23 AM2/19/18
to MIT App Inventor Forum
Maybe you could explain what the purpose of these blocks are:

You are doing the same if twice. They may look different, but they are not.
Also, what are you trying to do in the for each loop?
Then, At initialize you are creating vNosMorse, which has all the information you need to translate numbers to morse code. Why ary you have the table1 and table2 procdures? This confuses the picture.
Also, You split the alertPhonenumber using a space. But the is no space in the phone number I assume. Split instead on "" (an empty string) and you will get a list of numbers.
(Correcting: you do have spaces in the number, but you want to take them out first, because you do not have morse for them. and you would get a list like this: (+133, 12, 133,133), for which you have no morse either. )

Some things to do! Cheers, Ghica.

Jaqueline

unread,
Feb 19, 2018, 7:43:42 AM2/19/18
to MIT App Inventor Forum
I am trying to check if the sender's phone number has its associate contact name or not.  If yes it will his name instead of the number, else it will show the phone number.
I used 2 "if ... then" because if I remove the first then I get a duplicate of the label many times.
I want now to convert what I received in the label in the phone number section: " 00:00:00 am From: ++++++++(or)Jaqueline  hi hello" .  If I got a phone number in the place of ++++++++ so convert the number else if I got the name of the sender so convert the name.

Ghica

unread,
Feb 19, 2018, 8:03:22 AM2/19/18
to MIT App Inventor Forum
Hi Jaqueline,

The red circled part does absolutely nothing, therefore you can remove it, or if it should do something correct it.
Why? the then is empty and there is no else. So whether the if is true or false, you do nothing. The for-loop goes through the numbers table, but only if you would do something with the numbers item (comparing it or something like that), it would do something. Now you are just looping without any consequences.
The blue circled part is a more difficult way of saying the same as the first if. You ask if ... = true, but you do not need the green block, because if implies the = true.

Then, if you are using a name instead of a number, what about the morse code? what would be its purpose?
Cheers, Ghica.

Jaqueline

unread,
Feb 19, 2018, 8:14:40 AM2/19/18
to MIT App Inventor Forum
You are right, I am going remove these blocks.
I want to create an application which receives the message then converts the sender's number/name to morse and after the message.
I did the message conversion.  I am stuck in the sender's phone number or name conversion.
I receive: (date) from: (number or name) (the message) in the label section.  I want to take that label as separate text, then take what is in between "from:" and "the message" and do the conversion.
I have done the message conversion by creating 2 lists but I don't know with app inventor how to take only what is between from: and the message .  

By doing this, I will get the number or name so I can easily convert it and display it in the textbox or another label

Ghica

unread,
Feb 19, 2018, 8:24:55 AM2/19/18
to MIT App Inventor Forum
You can use the contains (text, piece) text block to find out where from: is, Then using segment text to get the remainder of your message (everything after from:). But how you would be able to distinguish between the end of someone's name or the start of the message, I do not know.
Cheers, Ghica.

Jaqueline

unread,
Feb 19, 2018, 8:28:39 AM2/19/18
to MIT App Inventor Forum
But I want to convert also the message so I don't need to know where is the end.
Actually, I did the message conversion in another test application maybe I can join it with this one
 

Ghica

unread,
Feb 19, 2018, 10:47:23 AM2/19/18
to MIT App Inventor Forum
No you did not. I did.

So, why are you asking about converting numbers to morse if you already have app app that does the whole alfabet, including numbers?
While you are showing us an app that would require a lot of modification before it could work, even on only numbers??
While the only question you apparently had is how to find from: in a string???

You are wasting our time.
Remember that almost all of us are volunteers, doing this in our spare time.
Cheers, Ghica.

Jaqueline

unread,
Feb 19, 2018, 10:51:02 AM2/19/18
to MIT App Inventor Forum
Hello Tim,
I am getting in reverse order the conversion as a string.  Do you have any idea what could be the problem?
The conversion as a list is good.
Thanks in advance

Jaqueline

unread,
Feb 19, 2018, 11:03:15 AM2/19/18
to MIT App Inventor Forum
I asked the right question Ghica.  You didn't understand what I want.  I told you that I want to take the number/name in the middle of the text and convert to morse so how to do it.  And you said that you don't know.  Because my first question was answered by Tim with screenshots and I am using it now that is working for textbox.  That is why I asked what about phone numbers.  So now you can't say  that I am wasting your time.
And concerning the morse code, I know that I asked before and I got an answer but in this case it is not working,  don't think that I am asking you things that I didn't tried to solve or to waste time.  I tried before the code and the conversion for phone number it shows errors: "Cannot take ..." so that's why I asked the question because I thought that maybe for the phone numbers we can't use the same blocks that I already used for textbox.  In that case, I had 2 textbox and I just write and click OK to convert but now this is not the case.
So I am sorry if I wasted your time!!

 

Ghica

unread,
Feb 19, 2018, 2:42:20 PM2/19/18
to MIT App Inventor Forum
This is not a yes or no game. So, if it works for you, who am I to argue. It is your problem, not mine. Good luck with it. Ghica.

Larry Deack

unread,
Feb 19, 2018, 2:55:11 PM2/19/18
to MIT App Inventor Forum
Hi Jaqueline,

Ghica is just trying to get you to understand how to ask questions so you can get answers instead of frustrating everybody who tries to help you. I hope you solved your problems.

Jaqueline

unread,
Feb 19, 2018, 3:35:58 PM2/19/18
to MIT App Inventor Forum
Hello Larry,

I am not angry Larry, and I know that Ghica was trying to help me but look at her replies?? I didn't say any single word, she blamed me that I am showing an app full of errors and whatever, but this is the app that I am working on so what I am supposed to upload?? The code wasn't working for the texting component, hence I am new to app inventor and discovering things with every new project I thought that it works only for textboxes and maybe there will be another way to convert the phone number.

Yes what Tim provided (which is a new way) is working but I am getting the morse code in reverse order.
Thank you Larry for your suggestion, I will keep in mind what you said.

Abraham Getzler

unread,
Feb 19, 2018, 4:08:09 PM2/19/18
to MIT App Inventor Forum
what Tim provided (which is a new way) is working but I am getting the morse code in reverse order

In the join block that adds a new letter to the result,
put the new letter in the back instead of in the front.
 
ABG

TimAI2

unread,
Feb 19, 2018, 5:48:31 PM2/19/18
to MIT App Inventor Forum
Sorry I didn't notice my error (reverse order to string)

As ABG says swap the global vMorseString block and the lookup in pairs block for label4/global vMorseString

Jaqueline

unread,
Feb 22, 2018, 6:20:26 AM2/22/18
to MIT App Inventor Forum
Hello Tim,
I am getting an empty list and empty label 4 by doing this.  Can you please indicate on your screenshot  by using any pen tool where you changed the blocks because I guess I changed the wrong one.
Thank you in advance,
Jaqueline

Abraham Getzler

unread,
Feb 22, 2018, 8:39:46 AM2/22/18
to MIT App Inventor Forum
Is any one going to post blocks?
I have lost track.
ABG

Jaqueline

unread,
Feb 23, 2018, 4:33:26 AM2/23/18
to MIT App Inventor Forum

Ghica

unread,
Feb 23, 2018, 6:48:36 AM2/23/18
to MIT App Inventor Forum
Can you give an example of what is in TextBox1 when you press button1?
Cheers, Ghica

Abraham Getzler

unread,
Feb 23, 2018, 9:35:34 AM2/23/18
to MIT App Inventor Forum
The split of vtelno at "" near the top of the code
looks fishy.

Is that a blank, or is it an empty string?

It's almost impossible to tell visually,
and makes a critical difference.

ABG

Reply all
Reply to author
Forward
0 new messages