Refresh Scene withh Task in Background

Skip to first unread message


Nov 23, 2021, 8:23:34 AM (8 days ago) Nov 23
to Tasker

I have a Scene for mpv (thats a media player like vlc), in addition with the great lua script simple-mpv-webui.
At the moment I created a kind of progress bar, with a slider, as there is no origin progress bar element in the Scene :(
It works, but I want to refresh the slider every maybe 5 seconds.
At the moment I use a Button 'Refresh', where I perform the Task again to set the position.
In the Task I do a Hide Scene and Show Scene to get the new values into the scene.

It doesnt work otherwise but it is ugly, because the Scene is shortly disappearing and reappearing, not nice.
I would like to refresh the values of the Scene Elements only, but the Task doesnt change them, when the Scene started this very Task. It works only if I do a Hide Scene and then again Show Scene Action in that Task.

Is there a recomended way to do this better?
I thought about the Return Value Action, the Scene Performs the Task, the Task returns its new values (separated with some special character) as Return to the Scene and the Scene does a Variable Split Action to get all new values and does some Scene-Element-Value Actions with them. This should work, but it is not that nice neither.
Still I dont know how to refresh automatically then.
Is there an easier way?


Xiaomi Mi A1 with Android 9 and Tasker 5.15.2-beta

I would post the Task and the Scene here, but it is already so big, I dont think this would be of much help.

Frank Roehm

Nov 24, 2021, 11:38:32 AM (7 days ago) Nov 24
To show what is not working I created a Task and Scene with the basic things I would need:

Here is the description of the Scene:

Scene: TestRefresh
  P:1026x636  L:-1x-1

    Orientation: System
    Background Colour: #33FFFFFF
    Action Bar Style: System
    Title: TestRefresh
    Icon: null
    Tab Labels:
    Key: 872

Element: txt_test/Text
    P:0,0 1019x379 L:-1,-1 -1x-1
    Text Size: 22
    Text Width Scale Percent: 100
    Text Colour: #FFFFFFFF
    Position: Centre
    Vertical Fit Mode: None
    Text Format: Plain Text

Element: cmd_exit/Button
    P:525,379 500x255 L:-1,-1 -1x-1
    Label: EXIT
    Label Size: 16
    Label Width Scale %: 100
    Label Colour: #FF000000
    Position: Centre
    Icon: null
    Click: 871

Element: cmd_refresh/Button
    P:0,380 500x255 L:-1,-1 -1x-1
    Label: REFRESH
    Label Size: 16
    Label Width Scale %: 100
    Label Colour: #FF000000
    Position: Centre
    Icon: null
    Click: 873

And here comes the Task:

    Task: zTestRefreshScene
    A1: Flash [
         Text: Refresh...
         Continue Task Immediately: On ]
        If  [ %caller1 !~ ui ]
    A2: Parse/Format DateTime [
         Input Type: Now (Current Date And Time)
         Output Format: HH:mm:ss
         Formatted Variable Names: %time
         Output Offset Type: None ]
    A3: Show Scene [
         Name: TestRefresh
         Display As: Activity, No Bar, No Status, No Nav
         Horizontal Position: 100
         Vertical Position: 100
         Animation: System
         Show Over Keyguard: On
         Continue Task Immediately: On
         Allow Outside Boundaries: On
         Blocking Overlay +: On
         Overlay +: On ]
    A4: Element Text [
         Scene Name: TestRefresh
         Element: txt_test
         Position: Replace Existing
         Text: Time: %time ]
The Scene should get the actual time in it's text field, but it is not changing.

Is this by design, that the Task cannot refresh an element in a Scene, if that very scene calls that Task?

Thanks if anybody can say something about that.

Reply all
Reply to author
0 new messages