Page 1 of 1

Navigating USSD and modifying variables

Posted: 24 Sep 2013 11:05
by webo
I'm very close to getting my flow working but I'm running into some complications. The logic is as follows:
  • Receive an SMS with specific keywords
  • Strip the first four characters from the SMS sender's number and save it as the new {sms_sender} variable
  • Enter in a USSD command, dial the USSD command, and confirm the action in the USSD menu (requires entering a number and pressing "send")
The issues I'm having are the following:

1. I can't seem to find how to strip out characters from a variable
2. How do I confirm an action in the USSD menu? is there a way to automatically enter the menu option from the dial string?

Thanks in advance!

Re: Navigating USSD and modifying variables

Posted: 24 Sep 2013 18:56
by Martin
You can use the substring-function in an action Script to remove the first 4 characters of the number.
Example script:
cleaned_number = substring(sms_sender, 4)

You can also place such a small script directly into a text field that accepts variables, for example: action Notification on Screen: {substring(sms_sender, 4)}

You probably have to use an action Control UI to simulate input and to press buttons in the USSD menu.
On a rooted device you can also use actions like Execute Root Command: input text 123 and Execute Root Command: input keyevent DPAD_CENTER. Please see following post for more details: DIY-Actions

Re: Navigating USSD and modifying variables

Posted: 25 Sep 2013 04:20
by webo
Thanks! So my device runs Android 4.0.4 which makes Control UI impossible to use but the rooted commands are working except for one thing:

The DPAD does not seem to press "send" in the USSD menu. What it ends up doing is creating a new line (carriage return) in the menu response field but does not actually send it.

Is there any way to "press a button" without using Control UI?

EDIT: Found the solution.

What I ended up doing was installing the Hackers Keyboard which opened up the ability to send a TAB command to navigate through the buttons and then use your DPAD command to "press" the button.

Thanks for all your help!

Re: Navigating USSD and modifying variables

Posted: 08 Apr 2014 18:34
by fosha
please i also need to know about this, dial *number# its easy but sending 1 or 2 for the chooses category is where i need help..