Tuesday, November 29, 2016

How to use Tasker | Part IV [Scenes]

Tasker is one of the most powerful which is used for task control and task automation app. In the previous post we learned about Shortcuts and Widgets & Associating tasks with context. In this post we will learn about:
  • Scenes
  • Displaying a scene
  • Using variables

Scenes

Scene creation is actually an advanced topic that deserves its own separate tutorial, but I'll briefly talk about it here for the sake of completeness.


A scene is a custom UI that you build from scratch. It can utilize elements that you most often find on UIs, including such elements as buttons, doodles, pictures, maps, menus, shapes (e.g., ovals, rectangles), sliders, text boxes, text input fields, and web viewer boxes. Every element is customizable. For demonstration purposes, I'll show you how to create a simple popup box that displays an SMS message when it arrives.
  1. Open the Scenes tab in Tasker.
  2. Add/Create a new scene. Provide a name for it. In this example, I'll use "PopSMS" as scene names
  3. You'll see the Scene Edit screen in Preview Mode, with a dotted box in the middle. The dotted box is your scene display area. You can resize this, if you want. You can also change the background color of the display area, if you want. For now, let's just stick to the default.
  4. To be able to add UI elements to the display area, you need to switch to Editing Mode by tapping the magnifier with an X at the lower-right corner. Then, hold down on the display area to bring up the UI elements menu.
  5. Tap on Text to add a text box to the display area. Keep its default name. In this text box we'll display the text body. So, as value for Text, we specify a variable, specifically the variable in the body of an SMS message. Tap the tag icon at the right of the Text label, scroll down, and tap "Text Body." You should find %SMSRB as the value for Text.
  6. Tap the virtual Back button to return to the Scene Edit screen.
  7. We'd like to show the name of the sender, too. So, let's add another text box to display the sender's name. Just follow the same procedure for adding a text box to display the SMS text body, but for Text value, choose "Text From Name." You should see the variable %SMSRN as the value for Text.
  8. Again, tap the virtual Back button to return to the Scene Edit screen.
  9. Finally, we'd like to add a button to close the popup box after the message is read:
  • Select "Button" from the list of UI elements. Just keep the button's default name.
  • For Label, you can use "OK," "Done," or "Close."
  • Then, specify the action to perform when this button is tapped. For that, switch to the Tap tab. Then, tap Add > Scene > Destroy Scene. This action, of course, does what it says -- it will destroy the scene that you specify in the Name field. Choose "PopSMS" as the scene to destroy. It should appear in the Name field.
     10. Tap the virtual Back button until you're back at the main Tasker screen. You should be able to find PopSMS on the Scenes tab.
                 

Displaying a scene

So far, I've only shown you the scene creation part. That scene will be useless unless it is displayed or showed. In this way, we have to make a task of showing the said scene. At that point, the task needs to be linked to a context; for this situation, the context will be an event, specifically, the event where the phone receives a text message.
  1. Open the Tasks tab. Create a new task by tapping the Add button (plus sign) at the lower-right corner. Name the task anything you want. In this example, I name it "ShowText." Tap the checkmark to save the name.
  2. On the Task Edit screen, tap the Add Action button (plus sign). Then, tap Scene > Show Scene.
  3. On the Action Edit screen, tap the magnifier icon at the right side of Name and select "PopSMS," which is the name of the scene that we created earlier.
  4. From the drop-down list under Display As, select " Dialog, Dim Behind Heavy." This will cause the scene to be shown as a dialog box, with everything behind it dimmed heavily.
  5. Tap the virtual Back button until you reach Tasker's main screen. You should be able to see "ShowText" listed on the Tasks tab. The task now needs to be linked to a context in order to execute it.
  6. Open the Profiles tab. Create a new profile and context by tapping the plus button at the lower-right of the screen. Select Event > Phone > Received Text. Just leave the default event settings as they are for now.
  7. Tap the virtual Back button to return to the main screen. You'll be shown a popup list of tasks to link to the new context and profile. Select "ShowText" from the list.
  8. Make sure that the newly created profile is enabled so that Tasker can execute the associated task when triggered.
The example above, of course, is a very rough one. But, if you have the time and the patience, you can refine it further. Tasker lets you tweak a lot of the details.

Using variables

define it simply, a variable is a name for a value that changes over time. Much the same as scene creation, Tasker variables are likewise unpredictable themes that merit their own different separate tutorials. I'll talk briefly about them, though, just to let you know what immense power you'll get if you just patiently climb the steep hill of learning how to use Tasker.
                 

In the past area about scene creation, you experienced two variables spoke to by %SMSRB and %SMSRN

If you've ever done some programming before, you'll be familiar with the concept of variables. They're close kin to variables that you keep hearing about in algebra class. To (for SMS Text Body and SMS Sender Name, respectively). These are examples of built-in variables that you can use in Tasker. You cannot set, create, or define these kinds of variables. (That's why they're called "built-in.") Tasker variables always begin with the percent (%) symbol. Variables in all uppercase are built-in variables. They are usually derived from system information, device status, or events. Some common examples are

%TIME - (current time),
%DATE - (current date),
%BATT - (current battery level), and
%WIFI
(whether Wi-Fi is enabled or not). Aside from built-in variables, there are two other variable types: local and global. Both are user-defined and user-created. The main difference between them is that local variables can be used only within the task or scene in which they are created, defined, or used; global variables are accessible to all of Tasker. Another main difference is in capitalization: local variables use all lowercase but global variables have at least one uppercase letter in its name. You're nearly done with this general tutorial about Tasker. If you want to learn more about how to use Tasker, or review in a visual way what I've discussed so far, you can watch our video tutorial in the next section.

Some things to keep in mind

Google has made some significant changes to Android, pushing some Tasker features out the door. These are not very common tasks and actions, though. I have been using the same Tasker projects for years and none have failed me yet. Have any of yours let you down?

Conclusion

Tasker is a capable, complex, and customizable robotization and programming application, yet it can scare to a few and may not be for the weak of heart. It additionally has a lofty expectation to absorb information - I myself can validate it - yet it's justified regardless of the inconvenience. It takes some an opportunity to get comfortable with, a great deal more to be capable with, however the time will be justified, despite all the trouble. It's a little cost to pay for the force, adaptability, and control that Tasker permits you to employ over your Android gadget. Do you utilize Tasker? What do you utilize it for? On the other hand, would you say you are new to Tasker? How's your involvement with it as such? Impart your Tasker encounters to us. Sound off in the remarks.