Windows desktop application robot

Get the code and run this example in your favorite editor on our Portal!

This software robot opens the Spotify desktop application, searches for the given song, and plays the song. The robot demonstrates the basic Windows-automation capabilities of the RPA Framework, using keyboard navigation.

This robot currently works only on Windows. You need to have the Spotify Premium desktop application (Windows) installed on your machine. The robot expects the user to be already logged in when it launches the application.

Using Windows search to find the Spotify desktop application

Song playing in the Spotify Windows desktop application

Robot script

*** Settings ***
Documentation     Spotify Windows desktop application robot. Opens the Spotify
...               desktop application, searches for the given song, and plays
...               the song. Demonstrates the basic Windows automation
...               capabilities of the RPA Framework.
Library           RPA.Windows

*** Variables ***
${SONG_NAME}=     Monody

*** Tasks ***
Open Spotify desktop application and play a song
    Open the Spotify desktop application
    Search for the song
    Select the song
    Play the song

*** Keywords ***
Open the Spotify desktop application
    Windows Search    Spotify
    Sleep    3s

Search for the song
    Send Keys    keys={CTRL}l
    Send Keys    keys=${SONG_NAME}
    Sleep    3s

Select the song
    Send Keys    keys={ENTER}{TAB}{ENTER}
    Sleep    3s

Play the song
    Send Keys    keys={ENTER}

Robot script explained

This section explains some of the keywords used in this robot script.

Windows Search    Spotify

The Windows Search keyword is provided by the RPA.Windows library. The keyword opens the application using the Windows search dialog.

Send Keys    keys={CTRL}l

The Send Keys keyword sends given keys to Windows. The {CTRL}l means Ctrl+L on Windows. See RPA.Windows documentation for the available key codes.

March 31, 2022