Refresh Scene withh Task in Background

25 views
Skip to first unread message

francwalter

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

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?

Thanks.
frank.

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

unread,
Nov 24, 2021, 11:38:32 AM (7 days ago) Nov 24
to tas...@googlegroups.com
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
    Subtitle:
    Icon: null
    Tab Labels:
  Events:
    Key: 872

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

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

Element: cmd_refresh/Button
  Geometry:
    P:0,380 500x255 L:-1,-1 -1x-1
  Content:
    Label: REFRESH
    Label Size: 16
    Label Width Scale %: 100
    Label Colour: #FF000000
    Font:
    Position: Centre
    Icon: null
  Events:
    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.

Frank
Reply all
Reply to author
Forward
0 new messages