Process Text Selected in an App

Learn how to take the selected text in an app, transform it in some way and send another text back

  1. joaomgcd
    In this example we're going to take a text selected in any app, translate it from Portuguese to English, return it back to the app and replace the original text with the translated text.
    Important: This only works on Android Marshmallow (6.0) and above.
    Here's how it looks in the end:



    STEP 1 - CREATE TRANSLATOR


    • Open AutoShare
    • Select Manage Text Processors
    • Select the + option at the top-right
    • Name your processor Translate PT-EN
    • Select a nice icon for it, like this one
    • Set the timeout to 5 seconds


    STEP 2 - USE TRANSLATOR IN CONDITION


    • Open Tasker
    • Create a new profile
    • Select the AutoShare Process Text event condition
    • Select the Translate PT-EN text processor
    • Accept the settings and create a task


    STEP 3 - TRANSLATE TEXT


    • Add a flash action with the text Translating %astext...
    • Add a new AutoWeb action
    • Select the Yandex Dictionary API. If you don't have it yet, import it in AutoWeb first
    • Under Languages write pt-en
    • Under Text write %astext
    • Select to get all output as shown in the video
    /!\ I found out that the Yandex Dictionary API translates only 1 word. If you want to translate multiple words you should use the Yandex Translate API also available via AutoWeb


    STEP 4 - RETURN PROCESSED TEXT TO CALLING APP


    • Add a flash action with the text Got translation: %tr_text
    • Add an AutoShare Process Text action
    • Set the Processed Text field to %tr_text
    • Back out of Tasker to save
    (i) This will send back the processed text to AutoShare, which in turn will return it to the original calling app


    STEP 5 - TEST


    • Open any app with an input
    • Write some text in portuguese like Olá
    • Select the text
    • Tap the menu icon in the text menu
    • Select AutoShare
    • Select the Translate PT-EN text processor



    When you do this, the selected text will be sent to AutoShare, will run the setup profile, which will translate the text and finally the text is returned to the calling app, replacing the selected text. :cool:
    chefgee likes this.

Recent Reviews

  1. lys063388
    lys063388
    5/5,
    very good
  2. chefgee
    chefgee
    4/5,
    It works well and is a great translater