STEP 1 - FIND NOW PLAYING BUTTON
In this example we come across a field that for some reason can't be clicked by AutoInput. We get around that by finding out an alternate field. Let's do that now.
- Create a new Task called "Find Now Playing Button"
STEP 2 - UI QUERY
- Insert an "AutoInput UI Query" action
- Select the "Variable Setup" option
STEP 3 - GET THE ARTIST FIELD
We just want to get the id of the field that contains the Artist name, so the variable name is not that important
- Open Spotify
- Make sure that the bottom "Now Playing" bar is being shown
- Take note of the Artist name that's shown there (in my case it's Radiohead)
- Pull down on the notification bar and click the "Accept" button in the AutoInput notification
- Back in AutoInput, find the Artist name, select it and click OK
- Enter any name for the Artist variable, like "Artist"
- Touch the "Variables" field
STEP 4 - COPY THE VARIABLE ID
Observe how the "Variables" field shows the id of the field followed by "=:=" and the name you gave the field
- Select the id part of the text
- Select "Copy", to copy it to your clipboard. We're going to need this for later.
- Cancel this action and Task. We're going to create the actual Task that clicks the thumbs up now
STEP 5 - CREATE TASK TO CLICK THUMBS UP
Before clicking the thumbs up we have to make sure that Spotify is on the right screen. To do this, we're going to query the screen and see if the "Based On" text is present. This text appears in the full screen "Now Playing" screen at the top left
- Create a new Task called "Thumbs Up Spotify"
- In this task add an "AutoInput UI Query" action
- Touch the "Variable Setup" option
STEP 6 - FIND "BASED ON"
You'll notice that AutoInput will automatically create a valid variable from the name you give it, which means setting it to lowercase and removing any spaces. Thus, the variable will be named %basedon
- Open Spotify
- Go to the full screen "Now Playing" screen
- Check that "Based On" appears in the top left corner
- Pull down on the notification bar and touch the "Accept" button in the AutoInput notification
- Back in AutoInput, select the "Based On" text and click ok
- Name this variable "Based On"
- Save these settings and go back to the Task
STEP 7 - ADD IF TO CHECK IF SPOTIFY IS OPEN
This checks if the currently running app is not Spotify. We're going to launch the app in this case
- Add an "If" action
- Set the condition to %aiapp doesn't equal Spotify
- Add an "End If" action to close the "If" block
STEP 8 - LAUNCH SPOTIFY IF NOT OPEN
- Inside the "If" add a "Launch App" action
- Select Spotify from the app list
- Go back to the task
STEP 9 - SET %CLICK
This serves the purpose of letting you know that you're going to need to click the bottom "now playing" bar later in the Task. Since we're going to need to click it in multiple situations, it's better to just set a variable indicating that fact, and then just have 1 action click it if this variable is set.
- Add a "Variable Set" action
- Set variable %click to 1
STEP 10 - SET CLICK IF NOT ON NOW PLAYING SCREEN
This will set the %click variable to 1 if we didn't find the "Based On" text in the "AutoInput UI Query" action at the beginning of the task. This means that the "Now Playing" screen is minimized and we need to click the bottom bar
- Add a "Variable Set" action after the "End If" with the same values
- Add an "If" condition inside this action
- Set this condition to %basedon isn't set
STEP 11 - ADD 3 SECOND WAIT AFTER LAUNCHING SPOTIFY
Almost forgot: when launching Spotify, you need to wait a few seconds for the app to be ready before you can click the bottom "Now Playing" bar. Spotify doesn't like it when you click the bar right away after it's opened, so you need to wait a bit.
- Add a 3 second "Wait" action before the "End If" action
STEP 12 - CLICK THE LOWER NOW PLAYING BAR
- Add an "AutoInput Action" Tasker action
- In the "Action" field select "Click"
- In the "Field Type" field, select "Id"
- In the "Field Id" field write the id of the field you found out earlier: com.spotify.music:id/artistAndAlbum
- Accept these settings and go back to the Task
STEP 13 - ADD 1 SECOND WAIT
Again, Spotify doesn't seem to like it when you click a button right away when it appears, so you'll need to wait a second before clicking the thumbs up button.
- Add a a 1 second "Wait" action
STEP 14 - LOOK FOR THUMBS UP BUTTON
We'll now find the actual "Thumbs Up" button
- Add an "AutoInput Action" Tasker action
- Select "Easy Setup"
STEP 15 - FIND THUMBS UP BUTTON
- Open Spotify on the "Now Playing" full screen view
- Pull down on the notification bar and touch "Add"
- Touch the Thumbs Up button
- In the AutoInput notification, touch "Accept"
- Back in AutoInput, select the "com.spotify.music:id/btn_thumbup" option, then the "Click" option
- Save these settings and go back to Tasker
STEP 16 - ONLY CLICK LOWER BAR IF %CLICK IS SET
Finally we'll need to make use of the %click variable we set before
- Edit the action where you click the bottom Now Playing bar in spotify
- Add an "if" condition inside that action
- Set the condition to %click is set
- Done! You can now assign this task to anything you like: a voice command, a pebble command, or anything else.