Creating AutoShare Commands for your Share Menus - a Detailed Tutorial. 2018-08-03

A step-by-step guide to setting up AutoShare Commands and using them in Tasker

  1. Tasker Pro
    AutoShare is an interesting and useful AutoApp that allows you to send data (mainly text or filepaths) from an applications's "Share" menu on your device over into Tasker for processing.

    Tasker can take that data and do whatever you'd like with it; for example process the text and put the new text in the clipboard, or move a group of files from one folder to another.

    This tutorial will cover the basics of creating "AutoShare Commands" that will appear in your device's applications' Share menu's, so you can more easily send that data to Tasker.

    First - open the AutoShare application itself from your device's App Drawer (not from within Tasker). You will see a category for "Commands" and also some checkboxes at the bottom. Make sure to check the box for "AutoShare Command". Then click the heading for "Manage Commands":

    [​IMG]

    You will then be brought to the "Commands" listing screen. Here it is with some Commands already in it. If you haven't created any yet - yours will be blank:

    [​IMG]


    Before we go about adding a Command to this list let's clarify what a AutoShare Command is, and what it does. The Commands you create here consist of only a text name and an icon. That's it. Once created - they will appear in your applications "Share" menus under "AutoApps Commands".

    However - they won't do anything until you create a Profile in Tasker to accept that particular Command's data, and then do something with that data in a Task. So when you add/create a new Command in the AutoShare app - keep in mind - it's just a name and a icon. It doesn't do anything...yet.

    So as an example of creating a new Command, click the + button at the top of the Commands screen:

    [​IMG]

    Type a name for your Command, for this example let's call it "To Uppercase". Select an icon for your command at the next prompt. It can be any icon you'd like it to be. (There will then be a screen about "Priority", don't worry about this, just click "OK"). And now the new Command is all set and you'll see it at the bottom of the Command List:

    [​IMG]

    Use your device's "Back" button to exit completely out of AutoShare and thereby save your new Command.

    Next open Tasker. Go to the Profiles Tab. Create a new Profile for Event > Plugin > AutoShare. You will get the AutoShare Profile configuration screen shown to you, click the pencil Icon in the upper right to edit it, you will arrive at:

    [​IMG]

    Since we will be receiving the data through the Command name we just created, click "Command" here. Then click "Command Filter". A list will popup with all the Command names created in the main AutoShare app thus far. Choose the one we created - "To Uppercase":

    [​IMG]

    Press the back key on your device to confirm it, then click the checkmark in the upper right of the screen to save the configuration:

    [​IMG]

    You will now see the Config Summary screen. It confirms the Command this Profile is listening/watching for is indeed "To Uppercase", and in the list of variables this Profile will pass to the linked Task - you will see a variable named %astext. A pic of the Config Summary screen:

    [​IMG]

    So from now on - whatever text you highlight in any application, and then click Share > AutoShare Command > To Uppercase - that text will come through this Profile, into the Task we are about to create, in the variable %astext. Now click that back arrow at the upper left to save the Profile.

    Tasker will now show you a list of all your Tasks. We need to create a new Task. At the very top of the list choose "New Task":

    [​IMG]

    As the Task's first Action - create an Alert > Flash Action. Type the following into the text field - "Data Received: %astext". You will also see the %astext variable name available if you click the Variable Tag in the upper right, since the Profile is passing it to this Task. Action should look like:

    [​IMG]

    Press the back arrow to save the Action. Now we want Tasker to do something with the text that comes into this Task. Since we named the AutoApps Command "To Uppercase" I think it makes sense for us to now have Tasker take the text, and make it Uppercase.

    Add a second Action of Variables > Variable Convert > Function: To Uppercase. Put %astext in the top field since it's the data we want to convert to uppercase. Leave "Store Result In" empty since we don't want another variable name created:

    [​IMG]

    Press the arrow in the upper left to save this Action. Your Task should now look like this:

    [​IMG]

    After Action 2 - whatever text is in the %astext variable will now be in all uppercase letters, still inside of %astext. Then, we need to put this transformed text someplace so that it can be used. What better place than the Clipboard? So add a 3rd action of System > Set Clipboard and in the top "Text" field just put %astext as so:

    [​IMG]

    Save the Action and finally add a 4th Action of another Alert > Flash and have it say "Data In Clipboard: %astext". This will show a confirmation message that the new text is in the Clipboard, and also show what the newly formatted text looks like. Here is the completed 4-Action Task:

    [​IMG]

    Click the arrow in the upper left to save the Task. You will see the Profile/Task is now listed in the Profiles Tab. Click the checkmark at the top of this main Tasker screen to save and active this Profile/Task:

    [​IMG]

    The whole AutoShare "system" we wanted to create is now complete! Exit Tasker and open any application where you can select, share, and paste text to see how it all works. Let's choose your device's "Messages" app. Create a new message, type some text - for example "Hello world, how are you?", select that text, then click Share:



    [​IMG]

    Next choose "AutoShare Command":

    [​IMG]

    And you should see the list of Command Names and Icons pop up just as you created them in the main AutoShare app. Choose the one we created -"To Uppercase":

    [​IMG]

    Now is where the magic happens! The text you selected in "Messages" gets sent into Tasker, you will see the Flash of the data received, and the Flash that it has been put in the Clipboard. It should show you all uppercase in the second Flash message:

    [​IMG]

    Now use your device's "Paste" action to paste the new text anywhere, or conveniently for this demonstration - paste it back into the Messages text field:

    [​IMG]

    And that completes the entire process! Of course you can go in and change the Task to do anything you'd like with that text, or if you wanted to share a bunch of files to AutoShare, the Task will receive the filepaths in the %asfile() array from an app like your device's "Gallery" app.

    You can create new Commands in the main AutoShare app to do any of these things (provided of course you then link a Profile/Task in Tasker to each Command as shown above). Enjoy!

    (For your convenience the simple Profile created in this tutorial is available for download as XML Or - if you have Tasker 5.4.2b+ here is the direct Import Taskernet Link.)